Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d6199c94a6d04c9c91fa6048b82703332a297f8d04f04752e056f544473136b7
Ticket: 535705ffffffffffffffffffffffffffffffffff
Tcl interface to stop on encoding errors
User & Date: jan.nijtmans on 2021-03-25 23:03:36
Changes

  1. assignee changed to: "jan.nijtmans"
  2. closer changed to: "nobody"
  3. comment changed to:
    When [encoding convertto] encounters a character that 
    cannot be represented in the target encoding, it 
    silently substitutes a default instead. In the C 
    interface there is a flag TCL_ENCODING_STOPONERROR which 
    instead causes the underlying function to return with an 
    error when this condition occurs. It would be useful to 
    have a switch for [encoding convertto] to get the same 
    behaviour there, especially for cross-platform 
    installation programs (where encoding conversions are 
    common and unnoticed character substitutions can be very 
    dangerous).
    
    PS: While I'm at [encoding] anyway, I might as well 
    point out that the man page for the [encoding] command 
    (of Tcl8.4 as currently on tcl.activestate.com) in the 
    Example section incorrectly claims that "because the 
    source command always reads files using the ISO8859-1 
    encoding, Tcl will treat each byte in the file as a 
    separate character that maps to the 00 page in Unicode". 
    I believe the truth is rather that [source] uses the 
    system encoding. The example should work, since \xHH 
    produces character in said Unicode page, but including 
    the corresponding bytes as explicit characters in the 
    source probably won't work cross-platform.
    
  4. login: "jan.nijtmans"
  5. mimetype: "text/plain"
  6. severity changed to: "Minor"