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 Created on: 2023-04-13 20:46:59
Submitter: pooryorick Assigned to: pooryorick
Subsystem: - New Builtin Commands Severity: Important
Priority: 5 Medium Last modified: 2024-11-11 00:13:16
Status: Closed Closed by: pooryorick
Resolution: Fixed Closed on: 2024-11-11 00:13:16
Version:
Description:

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]

User Comments:
pooryorick added on 2023-04-14 07:23:20:

Fixed in [67baae2829].