commit | 372ac5e73260d6e8c8aefe31fd979a7706841868 | [log] [tgz] |
---|---|---|
author | Victor Stinner <victor.stinner@haypocalc.com> | Mon May 17 01:26:01 2010 +0000 |
committer | Victor Stinner <victor.stinner@haypocalc.com> | Mon May 17 01:26:01 2010 +0000 |
tree | 6c8feac35bff3c12181a819e4925f6d094831df4 | |
parent | 6baded49d0abf07f141dae489c6a010af1b1e209 [diff] [blame] |
PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead of strict) error handler to escape surrogates
diff --git a/Objects/object.c b/Objects/object.c index 8ddc7ec..1f4e3dd 100644 --- a/Objects/object.c +++ b/Objects/object.c
@@ -303,7 +303,9 @@ } else if (PyUnicode_Check(s)) { PyObject *t; - t = _PyUnicode_AsDefaultEncodedString(s, NULL); + t = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(s), + PyUnicode_GET_SIZE(s), + "backslashreplace"); if (t == NULL) ret = 0; else {