diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-02-16 21:50:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2023-02-16 21:50:53 (GMT) |
commit | 45796af99db14504cedf31f0336e108930482ebf (patch) | |
tree | 2ab23d68db683df8b5bced7a4bd250d57e148173 | |
parent | 6bcdbfbf84232c936c8561526e8f3dccb216a56f (diff) | |
download | tcl-45796af99db14504cedf31f0336e108930482ebf.zip tcl-45796af99db14504cedf31f0336e108930482ebf.tar.gz tcl-45796af99db14504cedf31f0336e108930482ebf.tar.bz2 |
complete fix
-rw-r--r-- | generic/tclEncoding.c | 10 | ||||
-rw-r--r-- | tests/encoding.test | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index fe78e03..1d3a3eb 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2417,14 +2417,14 @@ UtfToUtfProc( result = TCL_CONVERT_MULTIBYTE; break; } - if (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT) || (flags & ENCODING_FAILINDEX)) { - result = TCL_CONVERT_SYNTAX; - break; - } + 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; - Tcl_UtfToUniChar(chbuf, &ch); + TclUtfToUCS4(chbuf, &ch); dst += Tcl_UniCharToUtf(ch, dst); } else { int low; diff --git a/tests/encoding.test b/tests/encoding.test index 1b41925..03f0273 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -849,10 +849,10 @@ test encoding-24.41 {Parse invalid utf-8 with -strict} -body { } -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\xED'} test encoding-24.42 {Parse invalid utf-8, fallback to cp1252 [885c86a9a0]} -body { encoding convertfrom -nocomplain utf-8 \xF0\x80\x80\x80 -} -result \xF0\u20AC\u20AC\u20AC +} -result \xF0\u20AC\u20AC\u20AC test encoding-24.43 {Parse invalid utf-8, fallback to cp1252 [885c86a9a0]} -body { encoding convertfrom -nocomplain utf-8 \x80 -} -result \u20AC +} -result \u20AC file delete [file join [temporaryDirectory] iso2022.txt] |