Kaydet (Commit) 2412853f authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Fix escaping of non-ASCII characters.

üst 8a64d409
#! -*- coding: koi8-r -*-
assert u"".encode("utf-8") == '\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd'
assert u"\".encode("utf-8") == '\\\xd0\x9f'
......@@ -541,6 +541,7 @@ PyObject *PyString_DecodeEscape(const char *s,
end = s + len;
while (s < end) {
if (*s != '\\') {
non_esc:
#ifdef Py_USING_UNICODE
if (recode_encoding && (*s & 0x80)) {
PyObject *u, *w;
......@@ -656,8 +657,9 @@ PyObject *PyString_DecodeEscape(const char *s,
#endif
default:
*p++ = '\\';
*p++ = s[-1];
break;
s--;
goto non_esc; /* an arbitry number of unescaped
UTF-8 bytes may follow. */
}
}
if (p-buf < newlen)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment