lua-users home
lua-l archive

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


Mildred wrote:
[...]
> Do you know a library that could do that ?
> If it doesn't exists in plain Lua, perhaps there is a C library that
> would fit, I'm ready to do a Lua binding if necessary.

What you want is lua-iconv:

http://luaforge.net/projects/lua-iconv/

It'll convert from any Unicode encoding to any other Unicode encoding.
In your case, tell it to convert to UCS-32 and then you can read each
Unicode code point as a number type.

(Beware that a single glyph is not necessarily represented by a single
code point, though --- it's still not valid to stick your UCS-32 string
into an array of ints and expect string slicing to just work. Here Be
Dragons.)

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

Attachment: signature.asc
Description: OpenPGP digital signature