<div dir="ltr"><div>Based on the discussion in this thread and additional research, I came to the conclusion the current proposed resolution is incorrect and will submit a paper explaining why in details and proposing a better alternative.<br></div><div><br></div><div>Cheers,</div><div>Victor<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 18, 2019 at 10:29 AM Daniel Krügler via Lib &lt;<a href="mailto:lib@lists.isocpp.org">lib@lists.isocpp.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am So., 8. Sept. 2019 um 02:13 Uhr schrieb Tom Honermann via Lib<br>
&lt;<a href="mailto:lib@lists.isocpp.org" target="_blank">lib@lists.isocpp.org</a>&gt;:<br>
&gt;<br>
&gt; [format.string.std]p7 states:<br>
&gt;<br>
&gt; The positive-integer in width is a decimal integer defining the minimum field width.  If width is not specified, there is no minimum field width, and the field width is determined based on the content of the field.<br>
&gt;<br>
&gt; Is field width measured in code units, code points, or something else?<br>
&gt;<br>
&gt; Consider the following example assuming a UTF-8 locale:<br>
&gt;<br>
&gt; std::format(&quot;{}&quot;, &quot;\xC3\x81&quot;);     // U+00C1        { LATIN CAPITAL LETTER A WITH ACUTE }<br>
&gt; std::format(&quot;{}&quot;, &quot;\x41\xCC\x81&quot;); // U+0041 U+0301 { LATIN CAPITAL LETTER A } { COMBINING ACUTE ACCENT }<br>
&gt;<br>
&gt; In both cases, the arguments encode the same user-perceived character (Á).  The first uses two UTF-8 code units to encode a single code point that represents a single glyph using a composed Unicode normalization form.  The second uses three code units to encode two code points that represent the same glyph using a decomposed Unicode normalization form.<br>
&gt;<br>
&gt; How is the field width determined?  If measured in code units, the first has a width of 2 and the second of 3.  If measured in code points, the first has a width of 1 and the second of 2.  If measured in grapheme clusters, both have a width of 1.  Is the determination locale dependent?<br>
&gt;<br>
&gt; Proposed resolution:<br>
&gt;<br>
&gt; Field widths are measured in code units and are not locale dependent. Modify [format.string.std]p7 as follows:<br>
&gt;<br>
&gt; The positive-integer in width is a decimal integer defining the minimum field width.  If width is not specified, there is no minimum field width, and the field width is determined based on the content of the field.  Field width is measured in code units.  Each byte of a multibyte character contributes to the field width.<br>
&gt;<br>
&gt; (code unit is not formally defined in the standard.  Most uses occur in UTF-8 and UTF-16 specific contexts, but [lex.ext]p5 uses it in an encoding agnostic context.)<br>
&gt;<br>
&gt; Tom.<br>
<br>
Unfortunately, issue submission and LWG reflector announcement have<br>
been combined and a long thread was the consequence of this<br>
submission, please consider in the future to separate submission and<br>
LWG discussions.<br>
<br>
In this case a new issue has been created, please reload and double-check:<br>
<br>
<a href="https://cplusplus.github.io/LWG/issue3290" rel="noreferrer" target="_blank">https://cplusplus.github.io/LWG/issue3290</a><br>
<br>
Thanks,<br>
<br>
- Daniel<br>
_______________________________________________<br>
Lib mailing list<br>
<a href="mailto:Lib@lists.isocpp.org" target="_blank">Lib@lists.isocpp.org</a><br>
Subscription: <a href="https://lists.isocpp.org/mailman/listinfo.cgi/lib" rel="noreferrer" target="_blank">https://lists.isocpp.org/mailman/listinfo.cgi/lib</a><br>
Link to this post: <a href="http://lists.isocpp.org/lib/2019/09/13615.php" rel="noreferrer" target="_blank">http://lists.isocpp.org/lib/2019/09/13615.php</a><br>
</blockquote></div>