Lua - Printing ( ♡ ) character after parsing of JSON
json, lua, utf-8
Solution
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.
Problem
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?