summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEncoding.c2
-rw-r--r--tests/encoding.test3
2 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 380f3ed..95186af 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2602,7 +2602,7 @@ UtfToUtfProc(
*dst++ = 0xED;
*dst++ = (char) (((ch >> 16) & 0x0F) | 0xA0);
*dst++ = (char) (((ch >> 10) & 0x3F) | 0x80);
- ch = (ch & 0x0CFF) | 0xDC00;
+ ch = (ch & 0x03FF) | 0xDC00;
}
goto cesu8;
} else if ((ch | 0x7FF) == 0xDFFF) {
diff --git a/tests/encoding.test b/tests/encoding.test
index 5530178..86831b2 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -468,6 +468,9 @@ test encoding-15.30 {UtfToUtfProc -profile strict CESU-8} {
test encoding-15.31 {UtfToUtfProc -profile strict CESU-8 (bytes F0-F4 are invalid)} -body {
encoding convertfrom -profile strict cesu-8 \xF1\x86\x83\x9C
} -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xF1'}
+test encoding-15.32 {UtfToUtfProc CESU-8 [2f22a7364d]} -body {
+ encoding convertto cesu-8 \U1f600
+} -result \xED\xA0\xBD\xED\xB8\x80
test encoding-16.1 {Utf16ToUtfProc} -body {
set val [encoding convertfrom utf-16 NN]