diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-09-12 20:41:29 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-09-12 20:41:29 (GMT) |
commit | 393743bb7088f57b28cd5f98d2c9f70189807a2e (patch) | |
tree | aaedea2d95e3a091ee27030aa564047769784c1c /generic/tclEncoding.c | |
parent | c2626689e16b104637564825cd61b1b0ff14dfc2 (diff) | |
download | tcl-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.c | 8 |
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; |