Posted by LES on November 18, 2004
The code was posted here entirely at first, but I never succeeded in having all characters displayed correctly. Today (May 2007), I saw that many other characters were displayed incorrectly: a whole series of them displayed as question marks. I spent almost half an hour trying to correct it, but I couldn't make it work. Wikit keeps complaining about some "bogus" character and blames my browser (Firefox). Konqueror didn't work either. I give up. Just download the thing and move on.
RS Note that read includes the trailing newline; to write such a file-string out it is best to use puts -nonewline so you don't get an extra one. Also, string map is happy with long maps, so you can avoid the for loop by just coding
set XMLmap {& & < < > > ...} set HTMLmap {Ä Ä ...} ... set myMap $XMLmap ... set myText [string map $myMap $mytext]
Category Application - Category Characters - Category Dev. Tools - Category XML