lua-users home
lua-l archive

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

----- Original Message -----
From: David Dunham
Date: 10/14/2009 6:58 PM
On 14 Oct 2009, at 15:57, uri cohen wrote:
This is a version of
LUA where all internal strings are UTF16 (wide characters) rather than
chars, not a version with two types of strings like LuaState.
I assume you're aware that not all Unicode characters fit in 16 bits -- I never know if Windows wide character support realizes this.
I used the LuaPlus wide character string support to ship games to the Japanese market. For a computer/console game, there is almost always a known quantity of glyphs for a given language when localizing its string tables. Wide character string support covers this nicely.

LuaPlus achieves this via a C-like string representation:

HelloWorld = L"Hello world!"

Wide string hex representations of unprintable characters are as follows:

RandomCharacters = L"\x80fe\xabcd\x1234"

Of course, core Lua can support the string above, but what it can't do is proper endian conversion of the individual characters. Since it is known the string is wide, LuaPlus endian converts each character as necessary.

LuaPlus supports one other useful wide string feature. It knows how to read a UCS-2 encoded Lua source file. Instead of using the escape sequences in RandomCharacters above, the actual glyphs can be inserted into the file.

I apologize for hijacking the thread, but I really do feel it is useful to have wide character string support for my work within the games industry. For applications, wide characters may be worthless.