Windows CE/UTF-16/中文

Windows CE / UTF-16 / Chinese

我读到 Windows CE 使用 "UTF-16 version of UNICODE"(我是编码新手)。

当一个字符串包含一个需要超过 2 个字节的字符时会发生什么,比如汉字?需要3吗? 如果我有一个包含中文字符的字符串,访问第 N 个字节将不一定访问第 N 个可见符号?

还有性能呢?如果我理解得很好,每个可见符号的字节数可变的编码需要从头开始扫描字符串以访问第 N 个可见符号,对吗?如果是,那么对于 UTF-16 也是如此吗?

谢谢。

What happens when a string contains a character that requires more that 2 bytes, like Chinese characters? Does it take 3?

不,四个。

Wikipedia: UTF-16:

In UTF-16, code points greater or equal to 216 are encoded using two 16-bit code units.


If I understand well, encodings that have a variable number of bytes per visible symbol require the string to be scanned from the beginning to access the N-th visible symbol right?

是的。例如参见 [​​=13=].