Posted to tcl by kostix at Sun Oct 10 23:02:28 GMT 2010view raw

  1. % proc fixup s {
  2. variable map
  3. if {![info exists map]} {
  4. for {set i 0} {$i <= 0xFF} {incr i} {
  5. lappend map &#[format %.02x $i]\; [format %c $i]
  6. }
  7. }
  8. return [string map $map $s]
  9. }
  10. % fixup "aaa&#39;bbb"
  11. aaa9bbb