lua-users home
lua-l archive

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


On 5 July 2012 16:32, Simon Orde <sorde@gotadsl.co.uk> wrote:
>

> And yet your suggestion seems like the perfect solution to using Lua
> with Unicode.  If it works, surely it's what everyone should be doing?

I don't see why everyone should be doing it. I use UTF-8, which works
fine with the standard Lua interpreter's loader. UTF-8 can also be
used transparently through most of Lua, including its standard
libraries, and many third-party ones (I made a more lengthy write-up
at http://stackoverflow.com/a/10268913/15996 ).

Thus a UTF-16 -> UTF-8 conversion on load seems to be the ideal
solution to your problem. The mechanism is official, and documented,
using the lua_Reader parameter to lua_load():
http://www.lua.org/manual/5.1/manual.html#lua_load - simply perform
the transformaion there.

Regards,
Matthew