Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Under strict encoding, [gets] returns an error even though a complete line is available

Closed / Fixed0cd1ae596e70925906ace67831f123e6b2ec2035Created 4 years agoUpdated 2 years ago
Descriptionwiki2023-04-13 20:46:59
The following script should print the first line read from the file but instead it produces the error, "invalid or incomplete multibyte or wide character". There is a utf-8 encoding in the second line, not the first:
set chan [file tempfile]
chan configure $chan -encoding binary
# \xc0 is invalid in utf-8
puts -nonewline $chan a\nb\xc0\nc\n
flush $chan
seek $chan 0
chan configure $chan -encoding utf-8 -buffering none -eofchar {} -translation lf -profile strict
puts [gets $chan]
pooryorick Ticket [0cd1ae596e]: 3 changes [History diff]2023-04-13 20:51:05
pooryorick Ticket [0cd1ae596e]: 3 changes [History diff]2023-04-13 20:51:18
pooryorickwiki2023-04-14 07:23:20

Fixed in [67baae2829].

pooryorick Pending ticket [0cd1ae596e]. [History diff]2023-04-14 07:23:41
jan.nijtmans Closed ticket [0cd1ae596e]. [History diff]2023-09-12 13:09:51
pooryorick Ticket [0cd1ae596e]: 5 changes [History diff]2024-11-11 00:13:16
Log in (anonymous is fine) to add a comment.