Recently, "Martin v. Loewis"
This change works for me on Windows 2000 and allows access to all files no matter what the current code page is set to. On Windows 9x (not yet tested), the _wfopen call should fail causing a fallback to fopen. Possibly the OS should be detected instead and _wfopen not attempted on 9x.
Now that you have that change, please try to extend it to posixmodule.c. This is where I gave up. Notice that, with changing Py_FileSystemDefaultEncoding and open() alone, you have worsened the situation: os.stat will now fail on files with non-ASCII names on which it works under the mbcs encoding, because windows won't find the file (correct me if I'm wrong).
Could someone who really understands this issue (Martin?) perhaps
write a test case for this? I think something like creating a file
with some nonascii chars in the name, and verifying that open(),
readdir(), os.stat() and various others work as expected is what would
be needed (but I'm not sure I fully understand it:-).
--
- Jack Jansen