Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: bf8108a37e3ff8c053b928aed1b979ad82b39b12
Ticket: 539417ffffffffffffffffffffffffffffffffff
backslash causes scan to alter behavior
User & Date: blacksqr on 2002-04-04 19:45:32
Changes

  1. assignee changed to: "nijtmans"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The command:
    
    % scan - %c
    
    produces a different output than 
    
    % scan \- %c
    
    where "-" originated as hex 96 in cp1252.
    
    Details:
    
    I have a file called longdash.txt on my Windows machine
    which contains a single character, hex 96, which is a
    long dash in the default system encoding cp1252.  I
    read this file into a variable $longdash.  I try
    
    % puts $longdash
    -
    
    ...as expected.  Now I copy and paste the output
    character to get the next command:
    
    % scan - %c
    8211
    
    This is fine, tcl translated the character into its
    preferred encoding when the file was read.  Now I try
    
    % scan \- %c
    255
    
    Huh?
    
    This behavior prevents writing of generalized functions
    that accept a wide range of characters, since it is
    desirable to escape out some characters when feeding
    them to the scan command.  Characters with encodings
    higher than 255 have to be treated as a special case. 
    A backslash should be a guarantee of safety, not a data
    munger.
    
    Steve Huntley
    [email protected]
    
  4. foundin changed to: "obsolete: 8.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "blacksqr"
  9. subsystem changed to: "44. UTF-8 Strings"
  10. title changed to: "backslash causes scan to alter behavior"
  11. type changed to: "Bug"