binary scan \x90\x9f\x88@\xb9.\xc7\xda\x1b\x82j\xa3\xc6j\x11\x03 c* a foreach n $a { set j 0 while {[incr j]<9} {append k [expr \$n%2] set n [expr \$n/2]} append k \ } puts $k
Note that non-ascii characters in the above source code will be escaped (such as \x9f).