9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
|
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
|
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
lappend res [gets $f]
set status [catch {gets $f} cres copts]
lappend res $status $cres
chan configure $f -encodingstrict 0
lappend res [gets $f]
lappend res [gets $f]
close $f
return $res
return $res
} -cleanup {
removeFile io-75.14
} -match glob -result {a 1 {error reading "*": illegal byte sequence} bÀ c}
#test io-75.15 {invalid utf-8 encoding strict gets should not hang} -setup {
# set fn [makeFile {} io-75.15]
# set chan [open $fn w+]
# fconfigure $chan -encoding binary
# # This is not valid UTF-8
# puts $chan AB\xc0\x40CD\nEFG
# close $chan
#} -body {
# #Now try to read it with [gets]
# set chan [open $fn]
# fconfigure $chan -encoding utf-8 -encodingstrict 1
test io-75.15 {invalid utf-8 encoding strict gets should not hang} -setup {
set res {}
set fn [makeFile {} io-75.15]
set chan [open $fn w+]
fconfigure $chan -encoding binary
# This is not valid UTF-8
puts $chan hello\nAB\xc0\x40CD\nEFG
close $chan
} -body {
#Now try to read it with [gets]
set chan [open $fn]
fconfigure $chan -encoding utf-8 -encodingstrict 1
# # That next line will hang indefinitely
# set data [gets $chan]
# return $data
#} -cleanup {
# close $chan
# removeFile io-75.15
#} -match glob -result {41 1 {error reading "*": illegal byte sequence}}
lappend res [gets $chan]
set status [catch {gets $chan} cres copts]
lappend res $status $cres
set status [catch {gets $chan} cres copts]
lappend res $status $cres
lappend res [dict get $copts -result]
chan configur $chan -encoding binary
foreach char [split [read $chan 2] {}] {
lappend res [format %x [scan $char %c]]
}
return $res
} -cleanup {
close $chan
removeFile io-75.15
} -match glob -result {hello 1 {error reading "*": illegal byte sequence}\
1 {error reading "*": illegal byte sequence} AB c0 40}
# ### ### ### ######### ######### #########
test io-76.0 {channel modes} -setup {
set datafile [makeFile {some characters} dummy]
|