Tcl Source Code

View Ticket
Login
2023-04-21
23:02 Closed ticket [eabcbd0827]: read error persists on channel with strict encodin... artifact: 7095a50a45 user: pooryorick
2023-04-19
07:14 Ticket [eabcbd0827]: 4 changes artifact: f93f30508b user: pooryorick
2023-04-16
23:20 Ticket [eabcbd0827]: 3 changes artifact: 53b75900bd user: pooryorick
23:11 Ticket [eabcbd0827]: 3 changes artifact: 9c0bb685db user: pooryorick
23:10
Fix for [eabcbd08274f2d22], [read] error persists on channel with strict encoding after encoding is ... check-in: 3fa3d48874 user: pooryorick tags: trunk, main
23:02 New ticket [eabcbd0827] read error persists on channel with strict encoding af... artifact: 08ca84a852 user: pooryorick

Ticket UUID: eabcbd08274f2d22351fa96d972e4abfd08a8329
Title: [read] error persists on channel with strict encoding after encoding is changed to binary
Type: Bug Created on: 2023-04-16 23:02:06
Submitter: pooryorick Assigned to: pooryorick
Subsystem: - New Builtin Commands Severity: Important
Priority: 5 Medium Last modified: 2023-04-21 23:02:25
Status: Closed Closed by: pooryorick
Resolution: Fixed Closed on: 2023-04-21 23:02:25
Version:
Description:

In the script below, after the first [read] returns an encoding error, the channel is reconfigured to -encoding iso8859-1, and the subsequent [read] should return character \x81, but instead it repeats the error:

set res {}
set chan [file tempfile]
fconfigure $chan -encoding binary
# \x81 is invalid in utf-8. -eofchar is not detected, because it comes later.
puts -nonewline $chan A\x81\x1A
flush $chan
seek $chan 0
fconfigure $chan -encoding utf-8 -buffering none -eofchar \x1A \
-translation lf -profile strict
catch {read $chan} cres
puts $cres ;#-> error reading "file*": invalid or incomplete multibyte or wide character
puts [list eof [eof $chan]] ;#-> eof 1
puts [list position [tell $chan]] ;#-> position 1
chan configure $chan -encoding iso8859-1
catch {read $chan} cres
puts $cres] ;#-> error reading "file*": invalid or incomplete multibyte or wide character

User Comments:
pooryorick added on 2023-04-16 23:11:36:

Fixed in [3fa3d48874].