Наборы символов (character sets) в стандарте C++
Часто встречаю понятия типа basic character set, execution character set и т.п.. Какие бывают наборы символов и чем они отличаются? Где какой применяется и зачем требуется их разграничение?
Ответы (1 шт):
С basic character set все просто - в документе n3337 в пункте 2.3 они описаны так
The basic source character set consists of 96 characters: the space character, the control characters representing horizontal tab, vertical tab, form feed, and new-line, plus the following 91 graphical characters
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
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
0 1 2 3 4 5 6 7 8 9
_ { } [ ] # ( ) < > % : ; . ? * + - / ^ & | ! = , \ " ’
там есть поправка на их внешний вид, но это уже отдельно.
Там же рядом описана и execution character set
The basic execution character set and the basic execution wide-character set shall each contain all the members of the basic source character set, plus control characters representing alert, backspace, and carriage return, plus a null character (respectively, null wide character), whose representation has all zero bits. For each basic execution character set, the values of the members shall be non-negative and distinct from one another.
то есть basic character set плюс ещё чуточку.
- ontrol characters representing alert - https://en.wikipedia.org/wiki/Control_character
- backspace
- carriage return
- a null character
думаю, что если немного закрыть глаза, то очень грубо можно сказать что это первые 128 символов таблицы аски (в прочем, как почти любой современной кодировки - cp1251, uft-8)