[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions

R. David Murray report at bugs.python.org
Mon Jun 27 15:37:25 CEST 2011


R. David Murray <rdmurray at bitdance.com> added the comment:

rdmurray>python2.6 py27-str-unicode-bytes.py 
type(b)=<type 'str'>
Traceback (most recent call last):
  File "py27-str-unicode-bytes.py", line 17, in <module>
    unicode_str += b # this line will throw UnicodeDecodeError on Python 2.7
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 4: ordinal not in range(128)

And of course it doesn't work earlier than 2.6 since the b'' notation isn't supported before 2.6.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12398>
_______________________________________


More information about the Python-bugs-list mailing list