Description: |
(text/x-fossil-wiki)
In the script below, after the first [read] returns an encoding error, the
channel is reconfigured to <code>-encoding iso8859-1</code>, and the
subsequent [read] should return character <code>\x81</code>, but instead it
repeats the error:
<blockquote><code><verbatim>
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
</verbatim></code></blockquote>
|