[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Future plans for Lua and Unicode
- From: Matthew Wild <mwild1@...>
- Date: Thu, 5 Jul 2012 17:17:56 +0100
On 5 July 2012 16:32, Simon Orde <firstname.lastname@example.org> 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.