wynfield: > My base os is Japanese OEM Windows XP. > > I've only used the standard c:\cygwin-packages directory, so have not had any > problems. But, to confirm Gernot's report, I created a > C:\japanese_dirname日本語名 directory and tried to download a package into it. > It fails. > > setup reports the following type of message: > > No such file or directory: > C:\japanese_dirname日本語名/http%3...../release-2/..bzip_filename
The problem is that setup.exe's GUI uses the default ANSI codepage (932 in this case), whereas MSVCRT functions such as fopen() use the "C" locale by default. In the C locale, multibyte<->widechar conversion is a simple cast, which effectively yields ISO-8859-1. (Just to be clear, this is nothing to do with Cygwin/newlib's locale system, since setup.exe is a MinGW app). Now theoretically it should be possible to address this with a 'setlocale(LC_ALL, "")' call. However, after changing my Win7 system's default codepage to Japanese, I found that GetACP() would indeed return 932, but that 'setlocale(LC_ALL, "")' still yielded "English_United Kingdom.1252". Hence the slightly more circuitous route in the patch below. Seems to do the job. Andy --- main.cc 20 Sep 2009 16:41:30 -0000 2.56 +++ main.cc 3 Oct 2009 07:36:33 -0000 @@ -225,6 +225,11 @@ main (int argc, char **argv) hinstance = GetModuleHandle (NULL); #endif + // Make sure the C runtime functions use the same codepage as the GUI + char locale[12]; + snprintf(locale, sizeof locale, ".%u", GetACP()); + setlocale(LC_ALL, locale); + try { char cwd[MAX_PATH]; GetCurrentDirectory (MAX_PATH, cwd);