summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-12 20:41:29 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-12 20:41:29 (GMT)
commit393743bb7088f57b28cd5f98d2c9f70189807a2e (patch)
treeaaedea2d95e3a091ee27030aa564047769784c1c /generic/tclEncoding.c
parentc2626689e16b104637564825cd61b1b0ff14dfc2 (diff)
downloadtcl-393743bb7088f57b28cd5f98d2c9f70189807a2e.zip
tcl-393743bb7088f57b28cd5f98d2c9f70189807a2e.tar.gz
tcl-393743bb7088f57b28cd5f98d2c9f70189807a2e.tar.bz2
Start TIP #346 implementation: For now only \xC0\x80
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 0ce75b4..9c4b5ce 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2288,7 +2288,7 @@ BinaryProc(
*/
#if TCL_MAJOR_VERSION > 8 || defined(TCL_NO_DEPRECATED)
-# define STOPONERROR !(flags & TCL_ENCODING_NOCOMPLAIN)
+# define STOPONERROR (!(flags & TCL_ENCODING_NOCOMPLAIN) || (flags & TCL_ENCODING_STOPONERROR))
#else
# define STOPONERROR (flags & TCL_ENCODING_STOPONERROR)
#endif
@@ -2359,10 +2359,14 @@ UtfToUtfProc(
*dst++ = *src++;
} else if ((UCHAR(*src) == 0xC0) && (src + 1 < srcEnd)
- && (UCHAR(src[1]) == 0x80) && !(flags & TCL_ENCODING_MODIFIED)) {
+ && (UCHAR(src[1]) == 0x80) && (!(flags & TCL_ENCODING_MODIFIED) || ((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT))) {
/*
* Convert 0xC080 to real nulls when we are in output mode.
*/
+ if (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) {
+ result = TCL_CONVERT_UNKNOWN;
+ break;
+ }
*dst++ = 0;
src += 2;