summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-04-09 07:33:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-04-09 07:33:40 (GMT)
commit4f932058025998be42b8e9a68c8bbf148b32fc73 (patch)
tree1ec87cc742fd60810de8d2581bcde58b808f9914 /generic/tclStringObj.c
parent023286a7fd6c1818b91e8b241d64a86487113e94 (diff)
downloadtcl-4f932058025998be42b8e9a68c8bbf148b32fc73.zip
tcl-4f932058025998be42b8e9a68c8bbf148b32fc73.tar.gz
tcl-4f932058025998be42b8e9a68c8bbf148b32fc73.tar.bz2
Fix append-3.4, append-3.7 and utf-1.18 testcases
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index b557af0..6a63990 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1415,6 +1415,14 @@ Tcl_AppendObjToObj(
SetStringFromAny(NULL, objPtr);
stringPtr = GET_STRING(objPtr);
+ bytes = Tcl_GetString(appendObjPtr);
+ /* If appended string starts with a continuation byte or a lower surrogate,
+ * force objPtr to unicode representation. See [7f1162a867]
+ * This fixes append-3.4, append-3.7 and utf-1.18 testcases. */
+ if (((bytes[0] & 0xC0) == 0x80) || ((bytes[0] == '\xED')
+ && ((bytes[1] & 0xF0) == 0xB0) && ((bytes[2] & 0xC0) == 0x80))) {
+ Tcl_GetUnicodeFromObj(objPtr, &numChars);
+ }
/*
* If objPtr has a valid Unicode rep, then get a Unicode string from
* appendObjPtr and append it.