What is the encoding of __file__?

"Martin v. Löwis" martin at v.loewis.de
Mon Jan 7 18:02:56 EST 2008


> Thanks, I'll then use sys.getfilesystemencoding() to decode _file__
> and re-encode into utf-8, which is the default encoding of all strings
> in our software, as we deal a bit with Chinese terms.
> 
> Windows-1252 on my box. I just created a directory containing Chinese
> characters (on Vista), and whoa, files opened with IDLE are empty,
> import doesn't find modules in that directory. Of course Windows-1252
> can't encode these ...
> 
> But I understand that Python 3 will clean this up?

In theory, yes. The current implementation doesn't.

Contributions are welcome.

Regards,
Martin



More information about the Python-list mailing list