From 61b94514fc249fa89139ca71e85dea7bec9a39af Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Sat, 18 Feb 2023 19:44:20 -0800 Subject: [PATCH] P2713R1 Escaping improvements in std::format The wording has been integrated with the changes from P2736R2 (CWG Motion 8) according to the advise contained in that paper. Fixes NB US 098, FR 134 (C++23 CD). --- source/utilities.tex | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/source/utilities.tex b/source/utilities.tex index 683f0dc455..24c8414f45 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -15963,12 +15963,20 @@ \begin{itemize} \item \placeholder{CE} is UTF-8, UTF-16, or UTF-32 and -\placeholder{C} corresponds to either -a Unicode scalar value whose Unicode property \tcode{General_Category} -has a value in the groups \tcode{Separator} (\tcode{Z}) or \tcode{Other} (\tcode{C}) or to -a Unicode scalar value with the Unicode property \tcode{Grapheme_Extend=Yes}, +\placeholder{C} corresponds to a Unicode scalar value +whose Unicode property \tcode{General_Category} has a value in the groups +\tcode{Separator} (\tcode{Z}) or \tcode{Other} (\tcode{C}), as described by \UAX{44} of the Unicode Standard, or +\item +\placeholder{CE} is UTF-8, UTF-16, or UTF-32 and +\placeholder{C} corresponds to a Unicode scalar value +with the Unicode property \tcode{Grapheme_Extend=Yes} +as described by \UAX{44} of the Unicode Standard and +\placeholder{C} is not immediately preceded in \placeholder{S} by +a character \placeholder{P} appended to \placeholder{E} +without translation to an escape sequence, or + \item \placeholder{CE} is neither UTF-8, UTF-16, nor UTF-32 and \placeholder{C} is one of an implementation-defined set @@ -16050,7 +16058,8 @@ then \placeholder{C} is appended unchanged. \end{itemize} -%% FIXME: Example is incomplete; s2 and s6 are missing below; +%% FIXME: Example is incomplete; s2 and s6 from P2286R8 +%% and s8 (which should be s9) from P2713R1 are missing below; %% FIXME: their Unicode characters are not available in our font (Latin Modern). \begin{example} \begin{codeblock} @@ -16062,6 +16071,8 @@ string s4 = format("[{:?}]", string("\0 \n \t \x02 \x1b", 9)); // \tcode{s4} has value: \tcode{["\textbackslash u\{0\} \textbackslash n \textbackslash t \textbackslash u\{2\} \textbackslash u\{1b\}"]} string s5 = format("[{:?}]", "\xc3\x28"); // invalid UTF-8, \tcode{s5} has value: \tcode{["\textbackslash x\{c3\}("]} +string s7 = format("[{:?}]", "\u0301"); // \tcode{s7} has value: \tcode{["\u{301}"]} +string s8 = format("[{:?}]", "\\\u0301"); // \tcode{s8} has value: \tcode{["\\\u{301}"]} \end{codeblock} \end{example}