[RELEASED] Python 3.1 final

Nobody nobody at nowhere.com
Sun Jun 28 16:54:34 EDT 2009


On Sun, 28 Jun 2009 19:21:49 +0000, Benjamin Peterson wrote:

>> Yes, but do you get back the original byte strings?  Maybe I'm missing
>> something, but my impression is that this is still an issue for the email
>> module as well as command-line arguments and environment variables.
> 
> The email module is, yes, broken. You can recover the bytestrings of
> command-line arguments and environment variables.

1. Does Python offer any assistance in doing so, or do you have to
manually convert the surrogates which are generated for unrecognised bytes?

2. How do you do this for non-invertible encodings (e.g. ISO-2022)?

Most of the issues can be worked around by calling
sys.setfilesystemencoding('iso-8859-1') at the start of the program, but
sys.argv and os.environ have already been converted by this point.




More information about the Python-list mailing list