elementtree XML() unicode

Stefan Behnel stefan_ml at behnel.de
Wed Nov 4 14:35:30 CET 2009

John Machin, 04.11.2009 02:56:
> On Nov 4, 12:14 pm, Kee Nethery wrote:
>> The reason I am confused is that getResponse2 is classified as an  
>> "str" in the Komodo IDE. I want to make sure I don't lose the non-
>> ASCII characters coming from the URL.
> str is all about 8-bit bytes.

True in Py2.x, false in Py3.

What you mean is the "bytes" type, which, sadly, was named "str" in Python 2.x.

The problem the OP ran into was due to the fact that Python 2.x handled
"ASCII characters in a unicode string" <-> "ASCII encoded byte string"
conversion behind the scenes, which lead to all sorts of trouble to loads
of people, and was finally discarded in Python 3.0.


More information about the Python-list mailing list