lua-users home
lua-l archive

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

Martin wrote:
> On Sat, Mar 22, 2008 at 08:22:33AM +0900, Alex Davies wrote:
>> The same is said for string.char.  Or do you mean to say 
>> string.char(string.byte('!')) does not work as expected?
> Your example work as expected as long as char is within ASCII
> range. What does not work for me is
> string.char(string.byte('č'))
> as used character is c with carron encoded in utf-8 which makes
> it two bytes long. string.byte() use only the first of them (I guess)

Looking back from the beginning of the thread, yes, the reference
manual is terse and fat-free. I think it's intentional; I guess to
some extent, the intended reader, i.e. a developer, is expected to
know C and stuff like that, and be able drop down to look at the
sources, especially for examples of API usage.

Proper Unicode support is non-trivial. There are Unicode libraries
available from LuaForge or the Lua wiki. The following is probably
more helpful than me attempting an explanation of Unicode:

The level of Unicode support depends on what you are implementing.
Stuff like: Do you need normalizing? Etc. etc.

In an earlier post, you mentioned setting utf-8 on your computer,
but then you say, and I quote: "I do not know how they work under
Windows Unicode charset." Windows use UTF-16LE; I don't believe
you can set UTF-8 except in specific applications. You also use
the word "strange". You're sure you intend to use UTF-8 and not

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia