汉字编码标准与识别(三) 汉字编码标准与识别(三)内码转换表的来源与制作由于历史和地域的原因,电脑里的中文标准有不少种共存于Internet中。
这是现实。
因此出现了内码转换。
这方面的程序现在有不少。
不过大多是MS Windows的版本,并且有的毛病不少,所以有必要制作一个完整些的内码转换表。
资料来源自从Unicode/ISO10646/GB13000标准出现后,这项工作变得简单和繁琐。
因此制作转换表时有一个准则:以国际和国家标准为基准,参考有影响的商业公司的转换表,个人和小软件次之。
下面是资料的来源:一)国际和国家标准组织国际标准组织Unicode()提供了GB<=>Unicode转换表:ftp:///Public/MAPPINGS/EASTASIA/GBBIG5<=>Unicode转换表:ftp:///Public/MAPPINGS/EASTASIA/OTHERJIS<=>Unicode转换表:ftp:///Public/MAPPINGS/EASTASIA/JISKSC<=>Unicode转换表:ftp:///Public/MAPPINGS/EASTASIA/KSC因为GBK不是国家标准,所以Unicode并没有提供GBK<=>Unicode的转换表,而只是采用了Microsoft的code page的一个版本:ftp:///Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP{936,950}.TXT中国国家标准网入门太难,须8000元/个人。
因此没有得到正式的GB2312-1980和GB13000-1993的标准。
二)商业公司2.1方正集团字体部/fontweb/因为方正是产,学,研的综合体,在排版和字体领域奋斗多年,有很特殊的地位。
他们提供的转换表,几乎可以等同国家标准。
GB2312标准:/fontweb/gb2312.htmGBK标准:/fontweb/gbk.htmGB<=>BIG5转换表:/fontweb/download/Gb-big5.tabGBK<=>BIG5转换表:/fontweb/download/Gbk-big5.tab2.2Microsoft/Microsoft是谁也忽略不了的。
有时候就算是他们错了,最后也是对的。
在有些英文资料里把GBK说成是Microsoft制订的。
Microsoft从商业角度出发,提供的是code pages:GBK字形表:/typography/unicode/936gif.zipGBK<=>Unicode转换表:/typography/unicode/936.txtBIG5字形表:/typography/unicode/950gif.zipBIG5<=>Unicode转换表:/typography/unicode/950.txt在Windows97/98中文版里也提供了些资料:GBK标准:windowsGBK.txtcode pages:windowssystemcp{932,936,949,950}.nls三)个人与共享软件有不少个人和小团体也在这方面进行了探索。
3.1 TextPro /~buddha因为他们特殊的需求,TextPro确实在BIG5=>GBK/GB转换方面有独到之处。
同时还有个GBK(繁体)=>GB(简体)转换表,很有特色。
因为繁体=>简体是多对一的映射,因此很难有简体=>繁体的转换表。
特别是基于字到字的映射的转换是不可能的。
目前已有人进行基于词典和上下文的词到词的映射。
有兴趣可以看/articles/c2c.html3.2 Stone Chi 提供了基于RichWin的内码转换表。
收集了不少的资料,对内码标准有较深的了解。
同时还有一个中文检索软件值得一尝。
3.3 NJStar 和MagicWin .my他们在这领域有些日子了。
不过转换表不是很全。
制作根据上面的准则和排列次序制作。
如果上一级有空白,就要下一级填补;如果有冲突,就以上一级的为准。
一)根据Unicode的GB<=>Unicode与BIG5<=>Unicode转换表制作GB<=>BIG5 转换表。
二)根据Microsoft的GBK<=>Unicode与BIG5<=>Unicode转换表制作GBK<=>BIG5转换表。
至此,基于标准的转换实际已经完成。
Unicode的特点就是一字一码,一码一字。
各个国家和地区的汉字标准已编入Unicode的,并有相同的Unicode 码的汉字,就是叫CJK认同汉字。
但有些汉字因为种种原因而未能得到认同,如果制作这些汉字的转换表,只能是基于实用的,有可能多对多映射的转换表。
三)使用方正的GBK<=>BIG5转换表填充(一)的GB<=>BIG5转换表。
四)使用Microsoft的GBK<=>BIG5转换表填充(三)的GBK<=>BIG5转换表。
五)使用TextPro和stonec的GBK<=>BIG5转换表填充(四)的GBK<=>BIG5转换表。
六)NJStar的转换表虽然不是很全,但在BIG5=>GBK转换表中的C6行后半段和C7,C8行却相当完整。
上面的转换表在这里不是空白就是很少转换。
可能这个区域是属于扩充符号区,可有可无。
为保险起见,使用NJStar填充这个区域。
七)校验。
通过电脑对码表进行校验,发现在汉字编码方面基本一致。
有冲突的地方基本上是对制表符的理解不同造成的。
八)目测校验。
也就是用肉眼一个字一个字的检查。
这是最重要的一步。
但因为学识和精力有限,未能做到这一步。
UnicodeUnicode is a worldwide character-encoding standard. Windows NT, Windows 2000, and Windows XP useit exclusively at the system level for character and string manipulation. Unicode simplifies localization ofsoftware and improves multilingual text processing. By implementing it in your applications, you canenable the application with universal data exchange capabilities for global marketing, using a singlebinary file for every possible character code.Unicode defines semantics for each character, standardizes script behavior, provides a standardalgorithm for bidirectional text, and defines cross-mappings to other standards. Among the scriptssupported by Unicode are Latin, Greek, Han, Hiragana, and Katakana. Supported languages include, butare not limited to, German, French, English, Greek, Chinese, and Japanese.Unicode can represent all of the world's characters in modern computer use, including technical symbolsand special characters used in publishing. Because each Unicode code value is 16 bits wide, it is possibleto have separate values for up to 65,536 characters. Unicode-enabled functions are often referred to as"wide-character" functions. Note that the implementation of Unicode in 16-bit values is referred to asUTF-16. For compatibility with 8- and 7-bit environments, UTF-8 and UTF-7 are two transformations of16-bit Unicode values. For more information, see The Unicode Standard, Version 2.0.Windows supports applications that use either Unicode or the regular ANSI character set. Mixed use inthe same application is also possible. Adding Unicode support to an application is easy, and you can evenmaintain a single set of sources from which to compile an application that supports either Unicode or the Windows ANSI character set.Functions support Unicode by assigning its strings a specific data type and providing a separate set of entry points and messages to support this new data type. A series of macros and naming conventions make transparent migration to Unicode, or even compiling both non-Unicode and Unicode versions of an application from the same set of sources, a straightforward matter.Implementing Unicode as a separate data type also enables the compiler's type checking to ensure that only Unicode parameters are used with functions expecting Unicode strings.GBK字符集是对GB2312-80的一个扩展,达到GB13000的所有的20902个字符,里面还包含了繁体汉字,总共20975个汉字字符,911个非汉字符号和1894个用户定义字符(如偏旁、部首、笔画等)。