summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclIO.c2
-rw-r--r--tests/ioCmd.test10
2 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 47040d5..fed469c 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8354,7 +8354,7 @@ Tcl_SetChannelOption(
#ifdef TCL_NO_DEPRECATED
ResetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN);
#else
- if (SetFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
+ if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT) != CHANNEL_ENCODING_STRICT) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -nocomplainencoding: only true allowed",
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 73f0e1c..1a72f70 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -376,6 +376,16 @@ test iocmd-8.21 {fconfigure command / -nocomplainencoding 0 error} -constraints
} -body {
fconfigure $console -nocomplainencoding 0
} -returnCodes error -result "bad value for -nocomplainencoding: only true allowed"
+test iocmd-8.22 {fconfigure command / -nocomplainencoding 0, no error if -strictencoding already defined} -setup {
+ set console stdin
+ set oldmode [fconfigure $console -strictencoding]
+} -body {
+ fconfigure $console -strictencoding 1
+ fconfigure $console -nocomplainencoding 0
+ fconfigure $console -nocomplainencoding
+} -cleanup {
+ fconfigure $console -strictencoding $oldmode
+} -result 0
test iocmd-9.1 {eof command} {