UnicodeEncodeError in compile

Dave Angel d at davea.name
Wed Jan 11 06:45:43 EST 2012

On 01/11/2012 06:27 AM, pyscripter at gmail.com wrote:
> <SNIP>
> Maybe the example of this question can be added to the issue 13785 as a proof that compile fails on valid file names.
> But I think the real issue is why on modern Windows systems the file system encoding is mbcs.  Shouldn't it be utf-16?
Depends what you mean by modern. The following isn't true for Windows 
95, 98, nor ME.  But they weren't modern when they were first released.

NT systems, (which includes Win2k, XP, Vista, and Win7)  for at least 
the last 15 years, have used Unicode for the file system.  They also 
supply an "ASCII" interface.  If Python is using the latter, then it 
won't be able to access all possible files.

Now, it may be the fault of the C library that CPython uses.  I haven't 
looked at any of the code for CPython.

This is all from memory, as I haven't actively used Windows for some 
time now.  But I think the DLL name is kernel32.dll, and the entry 
points have names like  CreateFileW() for the unicode open, and 
CreateFileA() for the "ASCII" open.



More information about the Python-list mailing list