Martin Panter added the comment:

[Edit Error: 'utf8' codec can't decode byte 0xe2 in position 212: invalid 
continuation byte]

Re-reading the suggested description, it struck me that for encoding, this is 
redundant with the “backslashreplace” error handler:

>>> test = "".join(map(chr, range(sys.maxunicode + 1)))
>>> test.encode("raw-unicode-escape") == test.encode("latin-1", 
>>> "backslashreplace")

However, decoding also seems similar to “unicode_escape”, except that only 
\uXXXX and \UXXXXXXXX seem to be supported.

Maybe there should be a warning that backslashes are not escaped:

>>> "\\u005C".encode("raw-unicode-escape").decode("raw-unicode-escape")


Python tracker <>
Python-bugs-list mailing list

Reply via email to