summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-04-05 04:47:52 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-04-05 04:47:52 (GMT)
commit543bde3f267b817f06c56f74d3480c691866ecb1 (patch)
treee542ef53f829700969740db4e9d1f5b3e9a4a845 /generic/tclEncoding.c
parentd9bef75f08c6f69d631963242bdd1b887f8cb093 (diff)
parent096c6ef84ff367ccee30eb44d9833fe3f61c45cc (diff)
downloadtcl-543bde3f267b817f06c56f74d3480c691866ecb1.zip
tcl-543bde3f267b817f06c56f74d3480c691866ecb1.tar.gz
tcl-543bde3f267b817f06c56f74d3480c691866ecb1.tar.bz2
Merge 9.0
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 37e8638..f73666e 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2570,8 +2570,7 @@ UtfToUtfProc(
}
} else {
/*
- * Convert 0xC080 to real nulls when we are in output mode,
- * irrespective of the profile.
+ * For output convert 0xC080 to a real null.
*/
*dst++ = 0;
src += 2;
@@ -2822,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;