Overview
| Artifact ID: | c816081ce5cff8ed069fee2cdfe9d48c8ace8e430a12c9b4750247cf585e3c43 |
|---|---|
| Ticket: | b8f575aa2398b0e44b5a037326b9d75037e2da4a
Tcl 9: eof erroneously flagged with not reported encoding read error |
| User & Date: | pooryorick on 2023-01-16 20:31:36 |
Changes
- icomment:
Jan's proposed fix, [d156af9fb76dd2f4], changed the semantics of [read] (and [gets]?), as follows: In trunk, test io-12.9, "ReadChars: multibyte chars split FAILED" does not result in an error when the test is changed so that the channel is configured with -strictencdoing 1: <code><verbatim> test io-12.9 {ReadChars: multibyte chars split} -body { set f [open $path(test1) w] fconfigure $f -translation binary puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] fconfigure $f -strictencoding 1 -encoding utf-8 -buffersize 10 set in [read $f] close $f scan [string index $in end] %c } -cleanup { catch {close $f} } -result 194 </verbatim></code> This is incorrect. An error should be returned. If a second [read] is added, it returns an error: <code><verbatim> test io-12.9 {ReadChars: multibyte chars split} -body { set f [open $path(test1) w] fconfigure $f -translation binary puts -nonewline $f [string repeat a 9]\xC2 close $f set f [open $path(test1)] fconfigure $f -strictencoding 1 -encoding utf-8 -buffersize 10 set in [read $f] read $f close $f scan [string index $in end] %c } -cleanup { catch {close $f} } -result 194 </verbatim></code> This is also incorrect, because [read $chan] is defined to read all characters up until the end of the channel, implying that all data on the channel has been correctly read. The first [read] should return an error. - login: "pooryorick"
- mimetype: "text/x-fossil-wiki"