[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unicode and the io, os, and lfs libraries on Windows
- From: "David Burgess" <dburgess@...>
- Date: Wed, 14 Nov 2007 18:14:45 +1100
MultiByteToWideChar() and WideCharToMultiByte() provide a not too
difficult conversion. Keep all your strings in Lua as UTF-8 and
have one function to convert to unicode prior to using any of the
W API functions.
db
On 11/14/07, Matt Campbell <mattcampbell@pobox.com> wrote:
> As I mentioned the other day, I've been developing a collection of Win32
> API bindings. These bindings all use the Unicode versions of their
> corresponding Win32 functions; they take and return UTF-8 strings. Now,
> the problem is that the io, os, and lfs libraries don't take or return
> UTF-8 strings on Windows; they use the system's default code page, which
> is never UTF-8 (how I wish it was!). This means that if I do something
> like this:
>
> appDataDir = shlobj.GetSpecialFolderPath(nil, shlobj.CSIDL_APPDATA)
> f = io.open(appDataDir .. "\\foo.cfg")
>
> the second statement won't work if the application data directory
> contains non-ASCII characters.
>
> For consistency and to avoid debugging headaches on non-English Windows,
> I want to use UTF-8 everywhere. How should I solve this problem?
>
> Thanks,
> Matt
>