Character sets & encodings (C++23)
Overhaul of character sets, literal encodings, escape sequences, UTF-8 source, UAX#31 identifiers and the Unicode reference.
Connected features
Papers
13 · Virtual 2020 → Issaquah 2023Precisely specifies numeric (\x, octal) and universal-character escapes in narrow, wide and UTF literals.
Adopts Unicode UAX #31 (XID_Start/XID_Continue, NFC) for identifiers, disallowing e.g. emoji (DR).
Makes concatenation of string literals with different encoding prefixes ill-formed.
Requires diagnostic messages to preserve source characters rather than mangling them into an implementation-defined form.
Rewrites the description of character sets and encodings (translation/execution encodings, code units) in Unicode terms matching implementations.
Requires a character literal to have the same value in #if as in the same C++ expression.
Adds named universal character escapes: \N{LATIN SMALL LETTER A WITH ACUTE}.
Adds delimited escape sequences \x{…}, \o{…}, \u{…}, avoiding the greedy-hex problem.
Requires implementations to accept UTF-8 as a portable source-file encoding.
Makes wide character literals with multiple or non-encodable characters ill-formed.
Relaxes the requirement that wchar_t can hold every character of every locale, matching 16-bit wchar_t platforms (DR).
Restores initialization of char/unsigned char arrays from u8 string literals, for C compatibility (DR).
Replaces references to ISO/IEC 10646 with references to The Unicode Standard throughout.