diff options
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r-- | generic/tclEncoding.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 76a936c..3013916 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2328,7 +2328,7 @@ UtfToUtfProc( * If in input mode, and -strict is specified: This is an error. */ if (flags & TCL_ENCODING_MODIFIED) { - result = TCL_CONVERT_UNKNOWN; + result = TCL_CONVERT_SYNTAX; break; } @@ -2350,6 +2350,10 @@ UtfToUtfProc( result = TCL_CONVERT_MULTIBYTE; break; } + if (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT)) { + result = TCL_CONVERT_SYNTAX; + break; + } ch = UCHAR(*src++); } else { char chbuf[2]; @@ -2360,8 +2364,8 @@ UtfToUtfProc( } else { const char *saveSrc = src; size_t len = TclUtfToUCS4(src, &ch); - if ((len < 2) && (ch != 0) && STOPONERROR - && (flags & TCL_ENCODING_MODIFIED)) { + if ((len < 2) && (ch != 0) && (flags & TCL_ENCODING_MODIFIED) + && (((flags & TCL_ENCODING_STRICT) == TCL_ENCODING_STRICT))) { result = TCL_CONVERT_SYNTAX; break; } |