Antoine Pitrou <pit...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue9804> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com