[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: handle utf-8 filename in windows
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Sat, 4 Nov 2017 02:06:15 +0000
On Wed, Oct 25, 2017 at 4:00 PM, 云风 Cloud Wu <cloudwu@gmail.com> wrote:
> lua use fopen() in its base lib now, there are too troubles to support
> windows file system because of it :(
>
> I suggest lua use unicode version api of windows in future version, such as
> fopen -> _wfopen , and call MultiByteToWideChar to convert utf-8 filename to
> wchar_t first.
>
> I think let following apis support utf-8 filename in windows would be
> better:
> loadfile
> dofile
> require
> io.open
> os.remove
> os.rename
> os.execute
> os.getenv
I maintain a set of patches for Lua [1] and LuaFileSystem [2] that
does exactly that.
It converts all paths from UTF-8 to UTF-16 and calls the WCHAR
variants of the C library functions.
[1] https://bitbucket.org/doub/canopywater/src/tip/srcweb/lua-5.3.4/patches/lua-wstring
[2] https://bitbucket.org/doub/canopywater/src/tip/srcweb/luafilesystem-1.6.3/patches/win32-utf-8