summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-04 22:47:27 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-04 22:47:27 (GMT)
commit096c6ef84ff367ccee30eb44d9833fe3f61c45cc (patch)
treeb2031b9b19502aa0fda3757c6656bdc9e6fc2d69 /generic
parent294822067488bdff256df737ec9ccb614b928b59 (diff)
downloadtcl-096c6ef84ff367ccee30eb44d9833fe3f61c45cc.zip
tcl-096c6ef84ff367ccee30eb44d9833fe3f61c45cc.tar.gz
tcl-096c6ef84ff367ccee30eb44d9833fe3f61c45cc.tar.bz2
Fix [6390566ecd]: Testcase cmdAH-4.3.13.00DC0000.tail.utf-32.tcl8.a fails sometimes
Diffstat (limited to 'generic')
-rw-r--r--generic/tclEncoding.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 689fa50..e9b0cce 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2821,6 +2821,11 @@ Utf32ToUtfProc(
if ((unsigned)ch - 1 < 0x7F) {
*dst++ = (ch & 0xFF);
} else {
+#if TCL_UTF_MAX < 4
+ if (!HIGH_SURROGATE(prev) && LOW_SURROGATE(ch)) {
+ *dst = 0; /* In case of lower surrogate, don't try to combine */
+ }
+#endif
dst += Tcl_UniCharToUtf(ch, dst);
}
src += 4;