Here is my function, I am using lua-cjson which says it fully supports UTF-8
function getPersonaName(sid64)
local cjson = require "cjson"
local r = http.request("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=###&steamids=" .. sid64)
results = cjson.decode(r)
personaname = results.response.players[1].personaname
return personaname
When the user has some special character like ♡ my Lua code returns the personaname as
tam ♡
instead of
tam ♡
How can I correctly return the exact result?
That's an encoding issue. Whatever you are outputting the results to isn't expecting the UTF-8 encoded character you are sending it and so it is displaying it as best it can.
If you are in control of the display side of things then you need to look into changing the encoding it expects (or looking into how you can convert the UTF-8 into whatever encoding it does expect).
If you aren't in control of the display then there isn't much you can do about this other than to inform your users that they need to have their side of things configured correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With