8.7 KiB
[lex.charset]
5 Lexical conventions [lex]
5.3 Characters [lex.char]
5.3.1 Character sets [lex.charset]
The translation character set consists of the following elements:
each abstract character assigned a code point in the Unicode codespace as specified in the Unicode Standard, and
a distinct character for each Unicode scalar value not assigned to an abstract character.
[Note 1:
Unicode code points are integers in the range [0, 10FFFF] (hexadecimal).
A surrogate code point is a value in the range [D800, DFFF] (hexadecimal).
A Unicode scalar value is any code point that is not a surrogate code point.
â end note]
The basic character set is a subset of the translation character set, consisting of 99 characters as specified in Table 1.
[Note 2:
Unicode short names are given only as a means to identifying the character; the numerical value has no other meaning in this context.
â end note]
Table 1 — Basic character set [tab:lex.charset.basic]
| ð character |
glyph | |
|---|---|---|
| ð U+0009 |
character tabulation | |
| ð U+000b |
line tabulation | |
| ð U+000c |
form feed | |
| ð U+0020 |
space | |
| ð U+000a |
line feed | new-line |
| ð U+0021 |
exclamation mark | ! |
| ð U+0022 |
quotation mark | " |
| ð U+0023 |
number sign | # |
| ð U+0024 |
dollar sign | $ |
| ð U+0025 |
percent sign | % |
| ð U+0026 |
ampersand | & |
| ð U+0027 |
apostrophe | ' |
| ð U+0028 |
left parenthesis | ( |
| ð U+0029 |
right parenthesis | ) |
| ð U+002a |
asterisk | * |
| ð U+002b |
plus sign | + |
| ð U+002c |
comma | , |
| ð U+002d |
hyphen-minus | - |
| ð U+002e |
full stop | . |
| ð U+002f |
solidus | / |
| ð U+0030 .. U+0039 |
digit zero .. nine | 0 1 2 3 4 5 6 7 8 9 |
| ð U+003a |
colon | : |
| ð U+003b |
semicolon | ; |
| ð U+003c |
less-than sign | < |
| ð U+003d |
equals sign | = |
| ð U+003e |
greater-than sign | > |
| ð U+003f |
question mark | ? |
| ð U+0040 |
commercial at | @ |
| ð U+0041 .. U+005a |
latin capital letter a .. z | A B C D E F G H I J K L M |
| ð | N O P Q R S T U V W X Y Z | |
| ð U+005b |
left square bracket | [ |
| ð U+005c |
reverse solidus | \ |
| ð U+005d |
right square bracket | ] |
| ð U+005e |
circumflex accent | ^ |
| ð U+005f |
low line | _ |
| ð U+0060 |
grave accent | ` |
| ð U+0061 .. U+007a |
latin small letter a .. z | a b c d e f g h i j k l m |
| ð | n o p q r s t u v w x y z | |
| ð U+007b |
left curly bracket | { |
| ð U+007c |
vertical line | |
| ð U+007d |
right curly bracket | } |
| ð U+007e |
tilde | ~ |
The basic literal character set consists of all characters of the basic character set, plus the control characters specified in Table 2.
Table 2 — Additional control characters in the basic literal character set [tab:lex.charset.literal]
| ð character |
|
|---|---|
| ð U+0000 |
null |
| ð U+0007 |
alert |
| ð U+0008 |
backspace |
| ð U+000d |
carriage return |
A code unit is an integer value of character type ([basic.fundamental]).
Characters in a character-literal other than a multicharacter or non-encodable character literal or in a string-literal are encoded as a sequence of one or more code units, as determined by the encoding-prefix ([lex.ccon], [lex.string]); this is termed the respective literal encoding.
The ordinary literal encoding is the encoding applied to an ordinary character or string literal.
The wide literal encoding is the encoding applied to a wide character or string literal.
A literal encoding or a locale-specific encoding of one of the execution character sets ([character.seq]) encodes each element of the basic literal character set as a single code unit with non-negative value, distinct from the code unit for any other such element.
[Note 3:
A character not in the basic literal character set can be encoded with more than one code unit; the value of such a code unit can be the same as that of a code unit for an element of the basic literal character set.
â end note]
The U+0000 null character is encoded as the value 0.
No other element of the translation character set is encoded with a code unit of value 0.
The code unit value of each decimal digit character after the digit 0 (U+0030) shall be one greater than the value of the previous.
The ordinary and wide literal encodings are otherwiseimplementation-defined.
For a UTF-8, UTF-16, or UTF-32 literal, the implementation shall encode the Unicode scalar value corresponding to each character of the translation character set as specified in the Unicode Standard for the respective Unicode encoding form.