summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkUtil.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 1f574ec..bae589f 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1221,7 +1221,12 @@ TkUtfToUniChar(
Tcl_UniChar uniChar = 0;
size_t len = Tcl_UtfToUniChar(src, &uniChar);
- if ((uniChar & 0xFC00) == 0xD800) {
+ if ((sizeof(Tcl_UniChar) == 2)
+ && ((uniChar & 0xFC00) == 0xD800)
+#if TCL_MAJOR_VERSION > 8
+ && len == 1;
+#endif
+ ) {
Tcl_UniChar low = uniChar;
/* This can only happen if Tcl is compiled with TCL_UTF_MAX=4,
* or when a high surrogate character is detected in UTF-8 form */