Tcl Source Code

Ticket Change Details
Login
Overview

Artifact ID: ac313facd875225ce785e500ee683cfb58ec56f3
Ticket: 0e92c404f19ede5b2eb06e6db27647d3138cc56f
Side effect on string range command (from encoding and format commands)
User & Date: anonymous 2014-04-30 16:54:49
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Hi all,
    
    I found one very confusing behavior in tcl.
    
    set x "\u5317\u4eac"             # Beijing in Chinese
    set y $x
    puts "x: '$x' -> '[string range $x 0 100]''"
    puts "y: '$y'"
    encoding convertfrom "iso8859-1" $y
    puts "y: '$y'"
    # format "%s" $y
    puts "x: '$x' -> '[string range $x 0 100]'"
    
    output:
    x: '北京' -> '北京''
    y: '北京'
    y: '北京'
    x: '北京' -> '¬'
    
    
    if we uncomment second to last line above output is ok:
    
    x: '北京' -> '北京''
    y: '北京'
    y: '北京'
    x: '北京' -> '北京'
    
    
    
    encoding and format commands have side effects on string range command (In the second example they negate each other producing good result). Pay attention that neither x nor y were manipulated in any way. However string range command seems to be affected. I use tcl 8.5.
    
    Thanks,
    Nikola
    
  5. foundin changed to: "tcl 8.5"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "6b82a19e85309b70487c05b681a5f63a1a1d64bd"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "16. Commands A-H"
  15. title changed to:
    Side effect on string range command (from encoding and format commands)
    
  16. type changed to: "Bug"