[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Native unicode support?
- From: "Chung Jiho" <jiho@...>
- Date: Tue, 25 Jun 2002 18:15:27 +0900
Hello!
I found Lua a couple of days ago and thanked DDJ (http://www.ddj.com) for letting me find Lua :-) It's the simplest but most powerful language I've encountered. Now I'm moving my existing Python codes (which is to be embedded in C) into Lua codes. Everything seems to fine but I miss some features that exists in Python...
1. No unicode string - I'm from Korea and Korean needs 2 bytes per character. Python supports both multibytes encoding (euc--kr) and unicode encoding, and also supports native unicode string data type (put u before "" or '') I know there is Unicode-enabled Lua (http://www.workspacewhiz.com/Other/LuaState/LuaState.html) but is it going to merged into future versions of Lua? Or for the simplicity's sake unicode string support is deliberately removed from Lua?
I've found some workaround (using userdata and tag methods) but it is rather ugly to use. and also all Lua identifiers must be in [_a-zA-Z], the convinient table constructors can not be used with non-latin alphabets ( which I wanted very much :-( )
t = { pattern = "blah blah",
template = "halb halb" } -- It's ok
t = { <some korean text> = "blah blah",
<another korean text> = "halb halb"} -- Error
but, this can be done (since Lua is 8 bit clean)
t = {}
t[<some korean text>] = "blah blah"
Is unicode going to be supported in the next versions of Lua?
2. No "equal" tag method - I don't know if this is intended or not. But comparing two unicode user data needs tag method "equal" but there seems to be only "lt". builtin operator "==" for userdata seems to test identity (the same pointer) but not equivalence (comparing each characters, etc...) ...
Is the only solution implementing some function like "ustrcmp"?
Kind regards,
Jiho