[issue19279] UTF-7 to UTF-8 decoding crash

Guillaume Lebourgeois report at bugs.python.org
Thu Oct 17 17:13:00 CEST 2013


Guillaume Lebourgeois added the comment:

"Also, the usual way to decode by using the .decode method."

The original bug happened using requests library, so I have no leverage on the used method for decoding.

But if you used the "replace" mode with your methodology, you would have raised the same Exception : 

>>> content = b'+1911\' rel=\'stylesheet\' type=\'text/css\' />\n<link rel="alternate" type="application/rss+xml'
>>> content.decode("utf-7", "replace")
File "<stdin>", line 1, in <module>
  File "/lib/python3.3/encodings/utf_7.py", line 12, in decode
    return codecs.utf_7_decode(input, errors, True)
SystemError: invalid maximum character passed to PyUnicode_New

----------

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


More information about the Python-bugs-list mailing list