Kaydet (Commit) 0e36826a authored tarafından Victor Stinner's avatar Victor Stinner

Fix UTF-7 encoder on Windows

üst 87a7c825
...@@ -4061,7 +4061,7 @@ _PyUnicode_EncodeUTF7(PyObject *str, ...@@ -4061,7 +4061,7 @@ _PyUnicode_EncodeUTF7(PyObject *str,
start = out = PyBytes_AS_STRING(v); start = out = PyBytes_AS_STRING(v);
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
Py_UNICODE ch = PyUnicode_READ(kind, data, i); Py_UCS4 ch = PyUnicode_READ(kind, data, i);
if (inShift) { if (inShift) {
if (ENCODE_DIRECT(ch, !base64SetO, !base64WhiteSpace)) { if (ENCODE_DIRECT(ch, !base64SetO, !base64WhiteSpace)) {
...@@ -4099,7 +4099,6 @@ _PyUnicode_EncodeUTF7(PyObject *str, ...@@ -4099,7 +4099,6 @@ _PyUnicode_EncodeUTF7(PyObject *str,
} }
continue; continue;
encode_char: encode_char:
#ifdef Py_UNICODE_WIDE
if (ch >= 0x10000) { if (ch >= 0x10000) {
/* code first surrogate */ /* code first surrogate */
base64bits += 16; base64bits += 16;
...@@ -4111,7 +4110,6 @@ encode_char: ...@@ -4111,7 +4110,6 @@ encode_char:
/* prepare second surrogate */ /* prepare second surrogate */
ch = 0xDC00 | ((ch-0x10000) & 0x3FF); ch = 0xDC00 | ((ch-0x10000) & 0x3FF);
} }
#endif
base64bits += 16; base64bits += 16;
base64buffer = (base64buffer << 16) | ch; base64buffer = (base64buffer << 16) | ch;
while (base64bits >= 6) { while (base64bits >= 6) {
......
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