Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: da305717868acf4b4dd230b0d44bd0778c9a09ea7f507ea5db5500b71c897aa9
Ticket: a7a89d422a4f5dd372e61a75acf5381142dde80f
Under strict encoding, [gets] returns an error instead of returning the second line
User & Date: apnadkarni on 2023-04-18 02:52:46
Changes

  1. icomment:
    As of commit [] on trunk, io-75.{14,15} are still failing on Windows.
    
    
    ```
    ==== io-75.14 [gets] succesfully returns lines prior to error
    
            invalid utf-8 encoding [gets] continues in non-strict mode after error FAILED
    ==== Contents of test case:
    
        lappend res [gets $chan]
        lappend res [gets $chan]
        set status [catch {gets $chan} cres copts]
        lappend res $status $cres
        chan configure $chan -profile tcl8
        lappend res [gets $chan]
        lappend res [gets $chan]
        close $chan
        return $res
    
    ---- Result was:
    {a\x0D} {b\x0D} 1 {error reading "file1a8aec7b500": invalid or incomplete multibyte or wide character} {c\xC0\x0D} {d\x0D}
    ---- Result should have been (glob matching):
    a b 1 {error reading "*": invalid or incomplete multibyte or wide character} c\xC0 d
    ==== io-75.14 FAILED
    
    
    
    ==== io-75.15 invalid utf-8 encoding strict
        gets does not hang
        gets succeeds for the first two lines FAILED
    ==== Contents of test case:
    
        #Now try to read it with [gets]
        fconfigure $chan -encoding utf-8 -profile strict
        lappend res [gets $chan]
        lappend res [gets $chan]
        set status [catch {gets $chan} cres copts]
        lappend res $status $cres
        set status [catch {gets $chan} cres copts]
        lappend res $status $cres
            chan configure $chan -translation binary
            set data [read $chan 4]
            foreach char [split $data {}] {
                    scan $char %c ord
                    lappend res [format %x $ord]
            }
        fconfigure $chan -encoding utf-8 -profile strict
            lappend res [gets $chan]
            lappend res [gets $chan]
        return $res
    
    ---- Result was:
    hello AB 1 {error reading "file1a8aecf4570": invalid or incomplete multibyte or wide character} 1 {error reading "file1a8aecf4570": invalid or incomplete multibyte or wide character} 43 44 c0 40 {EF\x0D} {GHI\x0D}
    ---- Result should have been (glob matching):
    hello AB 1 {error reading "*": invalid or incomplete multibyte or wide character} 1 {error reading "*": invalid or incomplete multibyte or wide character} 43 44 c0 40 EF GHI
    ==== io-75.15 FAILED
    
    ```
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"