Coded Character Set

ASCII -> GB2312 -> GBK

ASCII -> Unicode( Universal Multiple-octet Coded Character Set, Abbreviation:UCS)

UTF: UCS Transformation Format

 

UCS-2编码(16进制) UTF-8 字节流(二进制)
0000 - 007F 0xxxxxxx
0080 - 07FF 110xxxxx 10xxxxxx
0800 - FFFF 1110xxxx 10xxxxxx 10xxxxxx

 

UTF-8就是以8位为单元对UCS进行编码。从UCS-2到UTF-8的编码方式如下:

例如“汉”字的Unicode编码是6C49。6C49在0800-FFFF之间,所以肯定要用3字节模板了:1110xxxx 10xxxxxx 10xxxxxx。将6C49写成二进制是:0110 110001 001001,用这个比特流依次代替模板中的x,得到:11100110 10110001 10001001,即E6 B1 89。  

 

BOM: byte order mark

 

 

Windows 32和64, java, Net framework 都是2bytes, UTF-16编码.  类Unix下都是4bytes, UTF-32编码
posted @ 2015-01-03 17:21  StuJnX6ry  阅读(168)  评论(0编辑  收藏  举报