Unicode entries on sys.path
"Martin v. Löwis"
martin at v.loewis.de
Mon Dec 27 01:24:27 CET 2004
>>The real question here is: why does Python not support arbitrary
>>Unicode strings on sys.path? It could, in principle, atleast on
>>Windows NT+ (and also on OSX). Patches are welcome.
> Works for me on OSX 10.3.6, as it should: prior to using the sys.path
> entry, a unicode string is encoded with Py_FileSystemDefaultEncoding.
> I'm not sure how well it works together with zipimport, though.
As Vincent's message already implies, I'm asking for Windows patches.
In a Windows system, there are path names which just *don't have*
a representation in the file system default encoding. So you just
can't use the standard file system API (open, read, write) to access
those files - instead, you have to use specific Unicode variants
of the file system API.
The only operating system in active use that can reliably represent
all file names in the standard API is OS X. Unix can do that as
long as the locale is UTF-8; for all other systems, there are
restrictions when you try to use the file system API to access
files with "funny" characters.
More information about the Python-list