lua-users home
lua-l archive

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


Klaus Ripke a écrit :
On Wed, Sep 13, 2006 at 06:24:17PM +0300, Theodor-Iulian Ciobanu wrote:
  What modules do I need to be able to use unicode with Lua? (especially parsing of logs).
http://lua-users.org/wiki/LuaUnicode
And is there a way to use both ANSI and Unicode?
Yes, the snlunicode package provides two single-byte modules (ascii and latin1)
as well as two multi-byte modules (utf8 and grapheme) with full support
for all Unicode character classes, upper/lower etc in UTF-8.
Conversion between other Unicode encodings like UTF-16 native/BE/LE/BOM
and UTF-8 is trivial.

As Lisa pointed out, you should avoid UTF-16 like the plague.

Well, he is on Windows (XP or 2k, I suppose) and he is parsing log files which might be generated by some Windows tools, so uses the native encoding: UTF-16. I agree with Lisa, but on Windows, UTF-16 is almost unavoidable (even if MS provide functions to convert to UTF-8, which could be useful for processing in Lua).

The resource you gave is interesting, thanks.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --