summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r--generic/tclParse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c
index a2227f7..73de7e8 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -979,6 +979,15 @@ TclParseBackslash(
if (readPtr != NULL) {
*readPtr = count;
}
+ if ((result & 0xF800) == 0xD800) {
+ /* If result is a surrogate, Tcl_UniCharToUtf will try to
+ * handle that especially, but we don't want that here.
+ */
+ dst[2] = (char) ((result | 0x80) & 0xBF);
+ dst[1] = (char) (((result >> 6) | 0x80) & 0xBF);
+ dst[0] = (char) ((result >> 12) | 0xE0);
+ return 3;
+ }
return Tcl_UniCharToUtf(result, dst);
}