Tcl Source Code

View Ticket
Login
Ticket UUID: 0cd1ae596e70925906ace67831f123e6b2ec2035
Title: Under strict encoding, [gets] returns an error even though a complete line is available
Type: Bug Version:
Submitter: pooryorick Created on: 2023-04-13 20:46:59
Subsystem: - New Builtin Commands Assigned To: pooryorick
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2023-09-12 13:09:51
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2023-09-12 13:09:51
Description: (text/x-fossil-wiki)
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:

<blockquote><code><verbatim>
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]
</verbatim></code></blockquote>
User Comments: pooryorick added on 2023-04-14 07:23:20: (text/x-fossil-wiki)
Fixed in [67baae2829].