Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f78cf0cc95bc5235345fe7f232f8cf78b84923fc9f4b1526fbc62b84c19952b1
Ticket: 4a7397e0b3d60f1aebf50331b748da9493dba07d
Tcl 9: fcopy with -strictencoding 1 UTF-8 channels
User & Date: pointsman on 2022-12-22 13:27:22
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    package require Tcl 9
    
    # Create the test data
    set fd [open "data.txt" w+]
    fconfigure $fd -encoding binary
    # Not valid UTF-8
    puts $fd AB\xc0\x40CD\nEFG
    close $fd
    
    set in [open "data.txt"]
    set out [open "copy.txt" w+]
    fconfigure $in -encoding utf-8 -strictencoding 1
    fconfigure $out -encoding utf-8 -strictencoding 1
    fcopy $in $out
    
    Again I'm not sure how this is supposed to work
    but the result did surprise me.
    
    The script runs to its end without any error.
    The created file "copy.txt" is byte indentical with
    "data.txt".
    
    Neither the -strictencoding 1 on the in channel
    nor the -strictencoding 1 on the out channel seem
    to do anything, if the channels are used with fcopy.
    
    At minimum this should be noted either in the fcopy
    or the fconfigure documentation (I looked but didn't
    found something about this case atm).
    
    Better, I think, would maybe rasing error on the fcopy.
    But as written I'm not sure how this is supposed to work.
    
  5. foundin changed to: "Tcl 9, trunk"
  6. is_private changed to: "0"
  7. login: "pointsman"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "pointsman"
  14. subsystem changed to: "25. Channel System"
  15. title changed to: "Tcl 9: fcopy with -strictencoding 1 UTF-8 channels"
  16. type changed to: "Bug"