lua-users home
lua-l archive

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


I'm trying to write a full fledge application in Lua... questions related to I18N (aka internationalization) come knocking on my door more and more insistingly... and I have to pitifully admit that I'm at a total loss on how to even start to handle any of them in Lua's World...

First and foremost, character set encoding... I have been through the entire mailing list back and forth, but still no luck... Lua is rumored to be "8bit clean"... fine... but what does that mean as far as character set goes? Bits and bytes (clean or not) are utterly useless if I don't know what character set they do represent in practice. What character set does Lua use effectively?!?!? How do I find out about it? How do I convert things back and forth to it? How do I set it in the first place?

When I do aFile:read( "*all" ), what do I get back as far as character set goes? My OS do have a default character set encoding, but how do I know about it? When I do aFile:write( aContent ), what am I writing?!? What does string.byte() returns? In what encoding?

Then there is the fabled "setlocale" and its related idiosyncrasies... The Man hints that this may very well be the answer to many unanswered questions... but... how precisely does setlocale relates to character set encoding, if at all? How do I tell Lua that everything I want to deal with is UTF-8 encoded and that is it?!?!

Then there is the issue of setlocale scope... does it impact the entire VM? How do I handle several locales concurrently? For instance, lets assume that my application display its data according to HTTP's Accept-Language header. One request is in de_DE, the next one in fr_FR and so on, while the application default language is en_US. How does all this fit together?

In short, I'm at lost. Could any kind soul point me to any coherent resources which may shed some sense on any of this?

Thanks in advance.


PA, Onnay Equitursay