STINNER Victor added the comment:

> I believe Victor put quite a bit of time into trying to get more selective 
> approaches to work reliably and eventually gave up.

Yeah, it just doesn't work to use more than one encoding per process. You 
should use the same encoding for the whole lifetime of a process.

If you decode early data from an encoding A and later encode it back to 
encoding B, you get mojibake. The problem is simple.

Using more than one encoding per process means starting to make assumtpions on 
how data is used. For example, consider that environment variables use the 
encoding A, but filenames should use the encoding B. Or, but what if an 
environment variable contains a filename? Similar issues for command line 
arguments, subprocess pipes, standard streams (sys.std*), etc.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28180>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to