package require Tk
listbox .lb -yscrollcommand ".y set" -width 16
bind .lb <Double-1> {showCodepage .t [selection get]}
scrollbar .y -command ".lb yview"
text .t -bg white -height 32 -wrap word
pack .lb .y .t -side left -fill y
pack .t -fill both -expand 1
foreach encoding [lsort [encoding names]] {
.lb insert end $encoding
}
proc showCodepage {w encoding} {
$w delete 1.0 end
wm title . $encoding
set hexdigits [list 0 1 2 3 4 5 6 7 8 9 A B C D E F]
foreach high $hexdigits {
foreach low $hexdigits {
set c [encoding convertfrom $encoding [subst \\x$high$low]]
$w insert end "$high$low:$c "
}
$w insert end \n\n
}
} ;# RS
Arts and crafts of Tcl-Tk programming