lua-users home
lua-l archive

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


Am 06.08.2016 um 11:28 schröbte steve donovan:
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.

AFAIK, the Apache portable runtime does it like this on Windows. There's even a binding for Lua 5.1. APR is a bit difficult to build (especially on Windows), but it provides many of the usual OS services you might need ...


Philipp