Version 7 of Things Chinese

Updated 2007-08-29 10:31:23 by suchenwi

* Chinlish


A Chinese website dedicated to Tcl/Tk: http://tcltk.91com.net/

RS 2006-05-30 adds http://www.tclchina.com/

中文成?


RS 2007-08-29: Here's a converter from Chinese characters in Unicode to decimal GB2312 numbers:

 proc c2gb str {
   set res ""
   foreach c [split $str ""] {
      binary scan [encoding convertto gb2312 $c] cc a b
      set a [expr {($a+0x100) % 0x100 - 160}]
      set b [expr {($b+0x100) % 0x100 - 160}]
      lappend res [format %02d%02d $a $b]
   }
   set res
 }
 % c2gb 上海
 4147 2603

Category Human Language | i18n - Tcl for the world | Natural Languages