[Python-Dev] Add a new "locale" codec?

Victor Stinner victor.stinner at haypocalc.com
Thu Feb 9 10:30:11 CET 2012


> I think there's a general expectation that if you encode something
> with one codec you will be able to decode it with the same codec.
> That's not necessarily true for the locale encoding.

There is the same problem with the filesystem encoding
(sys.getfilesystemencoding()), which is the user locale encoding
(LC_ALL, LANG or LC_CTYPE)  or the Windows ANSI code page. If you
wrote a file using this encoding, you may not be able to read it if
the filesystem encoding changes between two run, or on another
computer.

I agree that it is more surprising because the current locale encoding
can change anytime, not only between two runs or when you use another
computer.

Don't you think that this special behaviour can be documented?

Victor


More information about the Python-Dev mailing list