Unicode字符编码模型
首先讲「字符编码模型」,主要是为了阐明概念和说明术语,以提供讨论的上下文。
在Unicode Technical Report #17 UNICODE CHARACTER ENCODING MODEL 中,将字符编码的结构建模为下面4层:
-
ACR: Abstract Character Repertoire 抽象字符表
-
The set of characters to be encoded, for example, some alphabet or symbol set
-
抽象字符表定义了待编码的无序字符集合,抽象字符指的是字母或者符号的本体
-
很多ACR是封闭的,一经确定不能更改,但是Unicode标准中的ACR是开放的,可以不断扩充
Unicode的实现可以只支持Universal Repertoire的子集
-
-
CCS: Coded Character Set 编号字符集
- A mapping from an abstract character repertoire to a set of nonnegative integers
- 编号字符集把抽象字符映射为(可以不连续的)非负整数,这个整数被称为抽象字符的码点(Code Point)
- 编号的范围被称为编号空间(Code Space)
- 编号的作用是为了方便管理和引用字符
- 例子:U+2013表示Unicode的 201 3 ( 16 ) 2013_{(16)} 2013(16) 号字符
-
CEF: Character Encoding Form 字符编码形式
- A mapping from a set of nonnegative integers that are element of a CCS to a set of sequences of particular code units of some specific width, such as 8-bit integers
- 字符编码形式将每个字符编号