lua-users home
lua-l archive

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


It depends on whether you want to use the encoding specified by the current locale, or always use UTF-8. The former is a more general solution and is probably preferred on Unix; GNU/Linux distributions are moving toward UTF-8 anyway. However, it's problematic on Windows; someone please correct me if I'm wrong, but I believe that UTF-8 is never (or rarely) the encoding associated with the system locale on Windows. So if you always want to use UTF-8, it's probably better to use a hand-written converter.

By the way, I find it annoying that on Windows, you have to use special wide-character functions if you want your code to be Unicode-aware; passing UTF-8 strings around would be a much more portable solution. I have considered developing an alternative C runtime library for Windows in which, among other differentiating features, UTF-8 would be assumed as the encoding for non-wide-character strings (so for example, you'd pass a UTF-8 string to fopen instead of having to call wfopen). Would there be any interest in this among Lua users?

--
Matt Campbell
Lead Programmer
Serotek Corporation
www.freedombox.info
"The Accessibility Anywhere People"