Unicode 格式控制字符(即 Unicode 字符数据库中的 “Cf” 类字符,如 LEF-TO-RIGHT MARK 或 RIGHT-TO-LEFT MARK)是在没有更高级别的协议(如标记语言)的情况下,用于控制一系列文本的格式化的控制代码。
The Unicode format-control characters (i.e., the characters in category “Cf” in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT MARK) are control codes used to control the formatting of a range of text in the absence of higher-level protocols for this (such as mark-up languages).
允许在源文本中使用格式控制字符,以方便编辑和显示。所有的格式控制字符都可以在注释中使用,也可以在字符串直接量、字符串模版直接量和正则表达式直接量中使用。
It is useful to allow format-control characters in source text to facilitate editing and display. All format control characters may be used within comments, and within string literals, template literals, and regular expression literals.
U+200C (零宽度非连接符)和 U+200D(零宽度连接符)是格式控制字符,用于在某些语言中组成单词或短语时进行必要的区分。在ECMAScript源文件中,这些代码点也可以用在第一个字符之后的 IdentifierName 中。
U+200C (ZERO WIDTH NON-JOINER) and U+200D (ZERO WIDTH JOINER) are format-control characters that are used to make necessary distinctions when forming words or phrases in certain languages. In ECMAScript source text these code points may also be used in an IdentifierName after the first character.
U+FEFF (零宽度无空隙字符)是一个格式控制字符,主要用于在文本的开头处标记为 Unicode,并允许检测文本的编码和字节顺序。
U+FEFF (ZERO WIDTH NO-BREAK SPACE) is a format-control character used primarily at the start of a text to mark it as Unicode and to allow detection of the text’s encoding and byte order.
characters intended for this purpose can sometimes also appear after the start of a text, for example as a result of concatenating files. In ECMAScript source text code points are treated as white space characters (see 11.2).
表 31 总结了对注释、字符串直接量和正则表达式直接量之外的某些格式控制字符的特殊处理。
The special treatment of certain format-control characters outside of comments, string literals, and regular expression literals is summarized in Table 31.
Table 31: Format-Control Code Point Usage
| Code Point 码点 |
Name 名字 |
Abbreviation 缩写 |
Usage 用法 |
|---|---|---|---|
| U+200C | ZERO WIDTH NON-JOINER 零宽非连接符 |
IdentifierPart | |
| U+200D | ZERO WIDTH JOINER 零宽连接符 |
IdentifierPart | |
| U+FEFF | ZERO WIDTH NO-BREAK SPACE 零宽无空隙字符 |
WhiteSpace |
