[issue9425] Rewrite import machinery to work with unicode paths

Kristján Valur Jónsson report at bugs.python.org
Tue Aug 24 23:04:38 CEST 2010


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

Yes.  in #1552880 I tried to make as minimal a change as possible.  This particular patch is still in use in EVE Online, which is installed in various strange and exotic paths in the orient..

The trick I employed there was to encode everything to utf-8 at the earliest oppertunity (current working directory, any unicode members in sys.path, etc.) and let the import.c machinery crunch that utf-8 code.  This works because path separators and other such stuff doesn't change under the utf-8 encoding.  As a final step, the utf8 encoded working string is converted back to unicode and native unicode API calls (on windows) are used to stat() and open() files.

A similar trick could be used on unix by converting from utf-8 to whatever native encoding the stat() and open() calls expect.

My patch never got accepted because I didn't have the time to put in the extra effort to make it cross platform.

----------
nosy: +krisvale

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9425>
_______________________________________


More information about the Python-bugs-list mailing list