Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ce5e1994d629943b89ee318251f2bea058bf27dc6a33c7ee199735f677c24d17
Ticket: fa3d9fd818fa0072b60dcd14614ebf33d90e4d6b
[fcopy $chan1 $chan2 -size $size] is not [puts -nonewline $chan2 [read $chan1 -size $size]
User & Date: pooryorick on 2023-04-03 20:55:33
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    Even if two channels have he same encoding [fcopy $chan1 $chan2 -size] might
    not be the same as [fcopy $chan1 $chan2 -size].  The makes [fcopy -size]
    difficult to use correctly.
    
    In the following script, copying with a size of 1 between to channels, both
    using utf-8 encoding, does not copy a full character. Although the behaviour is
    currently documented to be what it is, it's still bad, and should be fixed:
    
    
    <code><verbatim>
    set chan [file tempfile]
    chan configure $chan -encoding utf-8 -profile strict
    puts -nonewline $chan รก
    flush $chan
    chan configure $chan -profile tcl8 -translation lf -eofchar {}
    
    seek $chan 0
    set chandata [read $chan]
    
    set chan2 [file tempfile]
    chan configure $chan2 -profile tcl8 -encoding utf-8
    
    seek $chan 0
    fcopy $chan $chan2 -size 1
    flush $chan2
    
    seek $chan2 0
    set chan2data [read $chan2]
    close $chan2
    
    puts [list fcopy equals original? [expr {$chan2data eq $chandata}]]
    
    
    set chan3 [file tempfile]
    chan configure $chan2 -profile tcl8 -encoding utf-8
    seek $chan 0
    puts -nonewline $chan3 [read $chan 1]
    
    close $chan
    
    seek $chan3 0
    set chan3data [read $chan3]
    
    puts [list read/write equals original? [expr {$chan3data eq $chandata}]]
    </verbatim></code>
    
  5. is_private changed to: "0"
  6. login: "pooryorick"
  7. priority changed to: "5 Medium"
  8. private_contact changed to: "2b2275eab1118e1fab0016cf1c5702893c6af86c"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "pooryorick"
  13. subsystem changed to: "25. Channel System"
  14. title changed to:
    [fcopy $chan1 $chan2 -size $size] is not [puts -nonewline $chan2 [read $chan1 -size $size]
    
  15. type changed to: "Bug"