[Python-3000] Unicode and OS strings

Aahz aahz at pythoncraft.com
Sun Sep 16 02:40:05 CEST 2007


On Fri, Sep 14, 2007, "Martin v. L??wis" wrote:
>Hagen:
>> 
>> And what if we skillfully conserve unknown bytes in a private use or
>> surrogate area and the application author actually knows the encoding
>> and wants correctly decoded strings?
> 
> They can easily roundtrip that then to the encoding that it should have:
> 
> good_string = sys.argv[bad_string_index].\
>    encode(sys.argv_encoding, "pua-replace").decode(real_encoding)

That doesn't count as "easily" in my book.  What about a sys._argv_orig
containing bytes objects?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but
to post the wrong information.


More information about the Python-3000 mailing list