[issue9804] ascii() does not always join surrogate pairs

Antoine Pitrou report at bugs.python.org
Thu Sep 9 01:16:35 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

Or perhaps not, since we would like surrogate pairs to be fused in other cases (ascii() of other types) as well.

So "backslashreplace" would need to be changed instead:

>>> print("\U00012345".encode('ascii', 'backslashreplace'))
b'\\ud808\\udf45'

Expected result (already works in UCS4 builds):

>>> print("\U00012345".encode('ascii', 'backslashreplace'))
b'\\U00012345'

----------

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


More information about the Python-bugs-list mailing list