Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 53b75900bdbb2f42cc730709d38c89d43eb3c4aba8aa63d5cd5f54c36872875e
Ticket: eabcbd08274f2d22351fa96d972e4abfd08a8329
[read] error persists on channel with strict encoding after encoding is changed to binary
User & Date: pooryorick on 2023-04-16 23:20:09
Changes

  1. comment changed to:
    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>
    
  2. login: "pooryorick"
  3. mimetype: "text/plain"