Extremely urgent unicode issue

I download a json feed from a server, then decode it and when I try to put text into the window, I get nothing because the string contains Norwegian characters.

When I manually type the characters into my lua file, they do get displayed. I think it is the json interpreter that is messing everything up.

When I type out the contents I download as text, I get all norwegian characters, once they are decoded I get “?” instead.

Any plans for a fix ? I of course need to submit my app to apple today, this was just last minute changes when I found this out. [import]uid: 61610 topic_id: 15407 reply_id: 315407[/import]

Just posting that I have solved the issue. This requires manually fixing the unicoded characters like this

[lua] contents = fh:read()
contents = contents:gsub("\u00c5", “Å”)
contents = contents:gsub("\u00d8", “Ø”)
contents = contents:gsub("\u00c6", “Æ”)
contents = contents:gsub("\u00e5", “å”)
contents = contents:gsub("\u00e6", “æ”)
contents = contents:gsub("\u00f8", “ø”)[/lua]

This is something that the json interpreter should do itself [import]uid: 61610 topic_id: 15407 reply_id: 56938[/import]

I’ve had the same problems with unicode Spanish and I’ve used the solution traustitj :):

[lua]------------------------------------------------------------------------------------------------
– Convertir los caracteres desde unicode a utf-8

function conversorUnicode(contenido)
contenido = contenido:gsub("\u00e1", “á”)
contenido = contenido:gsub("\u00e9", “é”)
contenido = contenido:gsub("\u00ed", “í”)
contenido = contenido:gsub("\u00f3", “ó”)
contenido = contenido:gsub("\u00fa", “ú”)
contenido = contenido:gsub("\u00f1", “ñ”)

contenido = contenido:gsub("\u00c1", “Á”)
contenido = contenido:gsub("\u00c9", “É”)
contenido = contenido:gsub("\u00cd", “Í”)
contenido = contenido:gsub("\u00d3", “Ó”)
contenido = contenido:gsub("\u00da", “Ú”)
contenido = contenido:gsub("\u00d1", “Ñ”)

return contenido
end

print(conversorUnicode("\u00e1 \u00e9"))[/lua] [import]uid: 55048 topic_id: 15407 reply_id: 57964[/import]

Can anyone from Corona come up with a better solution? The functions for Asian languages will become quite huge… [import]uid: 83823 topic_id: 15407 reply_id: 63512[/import]

Hi stefan27.
I have same problem but I make little dirty hack code.

-- input: str formal JSON text (non ascii ¥u encode text  
-- return UTF8 JSON Text ¥uxxxx convered utf8 strings  
function u16json2RawStr(str)  
 return string.gsub(str,"\\u([0-9a-z][0-9a-z][0-9a-z][0-9a-z])",  
 function(s)  
 local v=0+ ("0x"..s)  
 if v \< 0x0080 then   
 return string.char(v)   
 elseif v \< 0x0800 then  
 local l = v % 64  
 local h = (v - l)/64  
 return string.char(h+0xc0, l+0x80)  
 else  
 local l = v % 64  
 local hm = (v % 4096)  
 local h = v - hm  
 local m = v - h -l  
 return string.char(h/4096 + 0xe0, m/64 +0x80 , l + 0x80);  
 end  
 end)  
end  

P.S.
I’m not native English speaker , My English is very very bad. [import]uid: 85008 topic_id: 15407 reply_id: 65025[/import]

Once I stopped using the standard json.lua recommended by Corona and switched to dkjson (which fully supports UTF-8) all my problems were solved! You can get it here: http://chiselapp.com/user/dhkolf/repository/dkjson/home [import]uid: 83823 topic_id: 15407 reply_id: 66296[/import]