[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: Paul Moore <p.f.moore@...>
- Date: Fri, 5 Aug 2016 21:03:38 +0100
On 5 August 2016 at 20:54, Paul K <paul@zerobrane.com> wrote:
>> Hmm, looks like it does more or less what I'm doing at the moment
>> (converting wide strings to Lua strings), but it doesn't use UTF-8,
>> but rather uses the ANSI codepage (so it's just as vulnerable to
>> mojibake as Lua's os.getenv, for example). But thanks for the pointer
>> anyway.
>
> 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.
Paul