[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Managing Unicode (UTF-8 and UTF-16) data in Lua
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 6 Aug 2016 11:28:08 +0200
On Fri, Aug 5, 2016 at 10:03 PM, Paul Moore <p.f.moore@gmail.com> wrote:
>> It does support UTF8, you just need to set it explicitly:
>> winapi.set_encoding(winapi.CP_UTF8).
>>
>> It will then be passed to MultiByteToWideChar, WideCharToMultiByte,
>> and other calls.
>
> Ah cool, I hadn't spotted that. It's not so important for my code to
> handle multiple encodings, though, so I'll probably just stick to
> UTF-8.
The trick is to always use the widechar variants of the API calls, and
convert UTF-8 to UTF-16 before calling them.
Sure, there will be some overhead, but might be useful to measure the
impact before designing around a problem which isn't a problem.
You are always free to regard the code as a source of spare parts ;)