What: char2ent.tcl Where: http://braziliantranslation.net/downloads/char2ent.tcl Description: Read an HTML or XML file containing literal special characters, then replace specials with appropriate SGML entities and output. Currently at version 0.0 . Updated: 11/2004 Contact: [LES] ---- [LES] on November 18, 2004: Get the code here: [http://braziliantranslation.net/downloads/char2ent.tcl] 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]