Closed rcane closed 5 years ago
Hi!
Thanks for reporting this. We know about this issue but have no good solution for it yet.
And it seems that nobody uses RESTinio on Windows with UNICODE enabled. Until now :)
So we have to address this issue somehow. But it'll take some time because there are holidays in our country from 5 to 9 of May.
I know about the hell you enter once you start trying to support unicode across platforms. ;-)
For now I simply changed the code to use CreateFileA
. This does not solve the unicode problem but it also does not make it worse.
The
open_file()
function in sendfile_defs_win.h usesCreateFile
to open the requested file path. This does not work if an application is compiled in unicode mode (i.e. UNICODE is defined). In this caseCreateFile
will be defined asCreateFileW
and its first parameter will effectively be awchar_t*
.There are two options to fix this. i) Just use
CreateFileA
(the ASCII version of the function) in either unicode and non-unicode mode. ii) Declare that theconst char *
parameter is a utf8-encoded string and convert it into utf16 in unicode mode.Option i) is simple to implement but restricts
sendfile
to ASCII paths. Option ii) is what one would actually want but needs a conversion from utf8 to utf16 (this code needs come from somewhere).