From: <tcl...@tc...> - 2014-04-30 17:01:21
|
Repository: http://core.tcl.tk/tcl Change Notification For [Side effect on string range command (from encoding and format commands)] Ticket http://core.tcl.tk/tcl/tktview?name=0e92c404f19ede5b2eb06e6db27647d3138cc56f Artifact http://core.tcl.tk/tcl/tinfo?name=ac313facd875225ce785e500ee683cfb58ec56f3 On 2014-04-30T16:54:49 By anonymous Changed Fields assignee: nobody closer: nobody comment: 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 foundin: tcl 8.5 is_private: 0 login: anonymous priority: 5 Medium private_contact: 6b82a19e85309b70487c05b681a5f63a1a1d64bd resolution: None severity: Important status: Open submitter: anonymous subsystem: 16. Commands A-H title: Side effect on string range command (from encoding and format commands) type: Bug |