diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-08-13 13:32:54 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-08-13 13:32:54 (GMT) |
| commit | 4027286a7ba3ed8c182f9a324eec91cbac1087bd (patch) | |
| tree | 86a98f63f31c66195a463a3d130a950795565429 | |
| parent | 2209c410ded320c8890025c9c91fa5f07d17e23d (diff) | |
| parent | 743157406f4e7a035661cc18d4f74921f94a2a01 (diff) | |
| download | tcl-4027286a7ba3ed8c182f9a324eec91cbac1087bd.zip tcl-4027286a7ba3ed8c182f9a324eec91cbac1087bd.tar.gz tcl-4027286a7ba3ed8c182f9a324eec91cbac1087bd.tar.bz2 | |
Fix [2f22a7364d]: cesu-8 encoding gives same result for different strings
| -rw-r--r-- | generic/tclEncoding.c | 2 | ||||
| -rw-r--r-- | tests/encoding.test | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index ee80ba4..64fb1b6 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2560,7 +2560,7 @@ UtfToUtfProc( *dst++ = 0xED; *dst++ = (char) (((ch >> 16) & 0x0F) | 0xA0); *dst++ = (char) (((ch >> 10) & 0x3F) | 0x80); - ch = (ch & 0x0CFF) | 0xDC00; + ch = (ch & 0x03FF) | 0xDC00; } *dst++ = (char)(((ch >> 12) | 0xE0) & 0xEF); *dst++ = (char)(((ch >> 6) | 0x80) & 0xBF); diff --git a/tests/encoding.test b/tests/encoding.test index 58f0956..fa237f8 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -466,6 +466,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] |
