Posted to tcl by stevel at Thu Jun 12 07:30:19 GMT 2008view pretty
proc u2a {s} { set res "" foreach i [split $s ""] { scan $i %c c if {$c<128} {append res $i} else {append res \\u[format %04.4X $c]} } return $res } puts -nonewline "input: " ; flush stdout while {[gets stdin line] >= 0} { puts [u2a $line] puts -nonewline "input: " ; flush stdout }