Skip to content

Commit 30983da

Browse files
author
jan.nijtmans
committed
Fix [63325009a8]: \u0400 conversion to and from cesu-8 fails.
1 parent dfa2b92 commit 30983da

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

generic/tclEncoding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2595,7 +2595,7 @@ UtfToUtfProc(
25952595

25962596
const char *saveSrc = src;
25972597
src += len;
2598-
if (!(flags & ENCODING_UTF) && !(flags & ENCODING_INPUT) && (ch > 0x3FF)) {
2598+
if (!(flags & ENCODING_UTF) && !(flags & ENCODING_INPUT) && (ch > 0x7FF)) {
25992599
if (ch > 0xFFFF) {
26002600
/* CESU-8 6-byte sequence for chars > U+FFFF */
26012601
ch -= 0x10000;

tests/encoding.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,9 @@ test encoding-15.31 {UtfToUtfProc -profile strict CESU-8 (bytes F0-F4 are invali
471471
test encoding-15.32 {UtfToUtfProc CESU-8 [2f22a7364d]} -body {
472472
encoding convertto cesu-8 \U1f600
473473
} -result \xED\xA0\xBD\xED\xB8\x80
474+
test encoding-15.33 {UtfToUtfProc CESU-8 [63325009a8]} -body {
475+
encoding convertto utf-8 \u0400
476+
} -result \xD0\x80
474477

475478
test encoding-16.1 {Utf16ToUtfProc} -body {
476479
set val [encoding convertfrom utf-16 NN]

0 commit comments

Comments
 (0)