lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


After a bit more re-engineering, I removed the need to html encode the data. My question is now as follows:

I have a variable thats latin-1 encoded, e.g. montr\xe9al . I want to convert that to montréal. I think I can use iconv, but using the iconv documentation, I'm not getting the expected output.

iconv = require("iconv")
cd = iconv.new('latin1', 'utf8')
city = "montr\xe9al"
nstr, err = cd:iconv(city)
print(nstr)
 
returns: montrxe9al

How can I convert montr\xe9al to montréal?

Thanks,
Chris