backslash causes scan to alter behavior
Closed / Duplicate539417ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2002-04-04 19:45:32
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]
hobbsplain2002-04-05 08:52:44
Logged In: YES user_id=72656 The noted chars don't correspond to longdash in cp1252 on my machine, but this sounds like bug 217987, which was fixed in 8.3.4 / 8.4a4.
Log in (anonymous is fine) to add a comment.