From dd56627191197f667a3d79d0f990757a3d366fb7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Jan 2021 15:06:34 +0000 Subject: Fix [c376607b22]: Tcl 8.6: Extended plane character does not encode correctly to UTF-16 with TCL_UTF_MAX==5 --- generic/tclEncoding.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 557f241..f1529e1 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2580,7 +2580,7 @@ UtfToUnicodeProc( *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF); *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8; *dst++ = (*chPtr & 0xFF); - *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC; + *dst++ = ((*chPtr >> 8) & 0x3) | 0xDC; } #else *dst++ = (*chPtr & 0xFF); @@ -2592,10 +2592,10 @@ UtfToUnicodeProc( *dst++ = (*chPtr >> 8); *dst++ = (*chPtr & 0xFF); } else { - *dst++ = ((*chPtr & 0x3) >> 8) | 0xDC; - *dst++ = (*chPtr & 0xFF); *dst++ = (((*chPtr - 0x10000) >> 18) & 0x3) | 0xD8; *dst++ = (((*chPtr - 0x10000) >> 10) & 0xFF); + *dst++ = ((*chPtr >> 8) & 0x3) | 0xDC; + *dst++ = (*chPtr & 0xFF); } #else *dst++ = (*chPtr >> 8); -- cgit v0.12