summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2002-04-10 17:18:02 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2002-04-10 17:18:02 (GMT)
commitce0b664af2b40c71a094b16d33b8310ff749f9df (patch)
tree7d8068117b88f805b76d17a6d2523512d0455fc4 /Objects
parenta9745611def1d7811210d45626f4b5d91d0b927c (diff)
downloadcpython-ce0b664af2b40c71a094b16d33b8310ff749f9df.zip
cpython-ce0b664af2b40c71a094b16d33b8310ff749f9df.tar.gz
cpython-ce0b664af2b40c71a094b16d33b8310ff749f9df.tar.bz2
Added test case for UTF-8 encoding bug #541828.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a49ff70..57c031f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1224,8 +1224,8 @@ PyObject *PyUnicode_EncodeUTF8(const Py_UNICODE *s,
Py_UCS4 ch2 = s[i];
/* Check for low surrogate */
if (0xDC00 <= ch2 && ch2 <= 0xDFFF) {
- ch = ((ch - 0xD800)<<10 | (ch2-0xDC00))+0x10000;
- *p++ = (char)((ch >> 18) | 0xf0);
+ ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x00010000;
+ *p++ = (char)(0xf0 | (ch >> 18));
*p++ = (char)(0x80 | ((ch >> 12) & 0x3f));
*p++ = (char)(0x80 | ((ch >> 6) & 0x3f));
*p++ = (char)(0x80 | (ch & 0x3f));