Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8c60f549a4ac78af8d64e44c46f82503697c8c982f063f9e607c2c6560402168
Ticket: b8f575aa2398b0e44b5a037326b9d75037e2da4a
Tcl 9: eof erroneously flagged with not reported encoding read error
User & Date: pointsman on 2022-12-08 23:00:58
Changes

  1. comment changed to:
    Create the test data:
    
    <pre>
    set myfd [open "data.txt" w+]
    fconfigure $myfd -encoding binary
    puts -nonewline $myfd A\x81BCDEFG
    close $myfd
    </pre>
    
    Then try this:
    
    <pre>
    set myfd [open "data.txt"]
    fconfigure $myfd -encoding utf-8 -strictencoding true -nocomplainencoding false
    set data [read $myfd]
    puts "eof [eof $myfd]"
    puts "fblocked [fblocked $myfd]"
    puts "data length [string length $data]"
    puts "data: $data"
    set data [read $myfd]
    </pre>
    
    I get:
    
    <pre>
    eof 1
    fblocked 0
    data length 1
    data: A
    error reading "file6": illegal byte sequence
        while executing
    "read $myfd"
        invoked from within
    "set data [read $myfd]"
    </pre>
    
    I guess this isn't supposed to work this way?
    
  2. login: "pointsman"
  3. mimetype: "text/plain"