From: Peter Krefting Date: Thu, 29 Oct 2009 09:01:01 GMT Subject: Re: [PATCH I18N filenames v2 3/3] Provide compatibility with MinGW Message-ID: In-Reply-To: <1256752900-2615-3-git-send-email-timur@iris-comp.ru> Hi! Timur Sufiev: > diff --git a/compat/mingw.c b/compat/mingw.c > index 6b5b5b2..2a2ebcb 100644 > --- a/compat/mingw.c > +++ b/compat/mingw.c > @@ -2,7 +2,7 @@ > #include "win32.h" > #include > #include "../strbuf.h" > - > +#include "../io-i18n.h" > #include > > static int err_win_to_posix(DWORD winerr) > @@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...) > if (!strcmp(filename, "/dev/null")) > filename = "nul"; > > - fd = open(filename, oflags, mode); > + fd = open_i18n(filename, oflags, mode); > > if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) { > DWORD attrs = GetFileAttributes(filename); Instead of calling the open_i18n() which converts from UTF-8 to a local 8-bit character set, this should probably call a version that converts from UTF-8 to UTF-16 and uses _wopen(). Same thing for fopen_i18n() and _wfopen(). I created a small RFC patch for that that changed parts of the system earlier this year - http://kerneltrap.org/mailarchive/git/2009/3/2/5350814 I did not address readdir() and friends, I'm not sure if they are available in UTF-16 form or if they need to be rewritten using findfirst()/findnext(). -- \\// Peter - http://www.softwolves.pp.se/