diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-02-17 19:14:42 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-02-17 19:14:42 (GMT) |
commit | c731ca1ffdd3e7cc90cf064ac89b2f71551958ce (patch) | |
tree | 2ab23d68db683df8b5bced7a4bd250d57e148173 /generic | |
parent | 2c3252bc5c0a80e90ade82389f8b80faa41a6e77 (diff) | |
parent | 45796af99db14504cedf31f0336e108930482ebf (diff) | |
download | tcl-c731ca1ffdd3e7cc90cf064ac89b2f71551958ce.zip tcl-c731ca1ffdd3e7cc90cf064ac89b2f71551958ce.tar.gz tcl-c731ca1ffdd3e7cc90cf064ac89b2f71551958ce.tar.bz2 |
Fix for [885c86a9a0]: convertfrom utf8 breaks for 4 byte utf encodings
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclEncoding.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 10789b1..1d3a3eb 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2417,16 +2417,14 @@ UtfToUtfProc( result = TCL_CONVERT_MULTIBYTE; break; } - if (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT) || (flags & ENCODING_FAILINDEX)) { - result = TCL_CONVERT_SYNTAX; - break; - } - ch = UCHAR(*src++); - } else { - char chbuf[2]; - chbuf[0] = UCHAR(*src++); chbuf[1] = 0; - TclUtfToUCS4(chbuf, &ch); + if (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT) || (flags & ENCODING_FAILINDEX)) { + result = TCL_CONVERT_SYNTAX; + break; + } } + char chbuf[2]; + chbuf[0] = UCHAR(*src++); chbuf[1] = 0; + TclUtfToUCS4(chbuf, &ch); dst += Tcl_UniCharToUtf(ch, dst); } else { int low; |