I开发者_开发问答'm watching ECMA-262 (JavaScript 5 edition) and cannot understand what is "code unit value"?
Can anyone tell me?
Thank you very much!
A JavaScript string is a sequence of unsigned 16-bit integers, also known as code units.
A code point is how the Unicode standard represents symbols and non-symbols. Code points are represented as a four-to-six digit hexadecimal number, typically prefixed with U+
, e.g. U+0061 LATIN SMALL LETTER A.
The difference is that what can be part of a code unit depends on the character encoding that is used. A code point however, is merely the concept of a “character” that can then potentially be encoded using UTF-8, for example.
For more information, read chapter 2 of the Unicode spec, especially 2.4 Code points and characters.
精彩评论