summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 51909c2..144954b 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2365,8 +2365,8 @@ UtfToUtfProc(
src += len;
dst += Tcl_UniCharToUtf(*chPtr, dst);
#if TCL_UTF_MAX == 4
- if (!len) {
- src += TclUtfToUniChar(src, chPtr);
+ if ((*chPtr >= 0xD800) && (len < 3)) {
+ src += TclUtfToUniChar(src + len, chPtr);
dst += Tcl_UniCharToUtf(*chPtr, dst);
}
#endif
@@ -2987,7 +2987,7 @@ Iso88591FromUtfProc(
if (ch > 0xff
#if TCL_UTF_MAX == 4
- || !len
+ || ((ch >= 0xD800) && (len < 3))
#endif
) {
if (flags & TCL_ENCODING_STOPONERROR) {
@@ -2995,7 +2995,7 @@ Iso88591FromUtfProc(
break;
}
#if TCL_UTF_MAX == 4
- if (!len) len = 4;
+ if ((ch >= 0xD800) && (len < 3)) len = 4;
#endif
/*
@@ -3425,7 +3425,7 @@ EscapeFromUtfProc(
break;
}
memcpy(dst, subTablePtr->sequence,
- (size_t) subTablePtr->sequenceLen);
+ subTablePtr->sequenceLen);
dst += subTablePtr->sequenceLen;
}
}