[Python-Dev] Import and unicode: part two

Victor Stinner victor.stinner at haypocalc.com
Wed Jan 26 12:57:16 CET 2011

Le mercredi 26 janvier 2011 à 11:12 +0100, "Martin v. Löwis" a écrit :
> There are cases where there is no real "transfer", in the sense in which
> you are using the word. For example, with NFS, you can access the very
> same file simultaneously on two systems, with no file name conversion
> (unless you are using NFSv4, and unless your NFSv4 implementations
> support the UTF-8 mandate in NFS well).

Python encodes the module name to the locale encoding to create a
filename. If the locale encoding is not the encoding used on the NFS
server, it doesn't work, but I don't think that Python has to workaround
this issue. If an user plays with non-ASCII module names, (s)he has to
understand that (s)he will have to fight against badly configured
systems and tools unable to handle Unicode correctly. We might warn
him/her in the documentation.

If NFSv3 doesn't reencode filenames for each client and the clients
don't reencode filenames, all clients have to use the same locale
encoding than the server. Otherwise, I don't see how it can work.

> Also, if two users of the same machine have different locale settings,
> the same file name might be interpreted differently.

Except Mac OS X and Windows, no kernel supports Unicode and so all users
of the same computer have to use the same locale encoding, or they will
not be able to share non-ASCII filenames.


Again, I don't think that Python should do anything special to
workaround these issues.

(Hardcode the module filename encoding to UTF-8 doesn't work for all the
reasons explained in other emails.)


More information about the Python-Dev mailing list