Skip to content

Instantly share code, notes, and snippets.

@ricardobeat
Created September 14, 2011 14:10
Show Gist options
  • Save ricardobeat/1216657 to your computer and use it in GitHub Desktop.
Save ricardobeat/1216657 to your computer and use it in GitHub Desktop.
proc ue_init {} {
lappend d + { }
for {set i 0} {$i < 256} {incr i} {
set c [format %c $i]
set x %[format %02x $i]
if {![string match {[a-zA-Z0-9]} $c]} {
lappend e $c $x
lappend d $x $c
}
}
set ::ue_map $e
set ::ud_map $d
}
ue_init
proc uencode {s} { string map $::ue_map $s }
proc udecode {s} { string map $::ud_map $s }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment