<div dir="ltr">Unfortunately, the standard currently says otherwise. [lex.phases] 5 says, for example:<br><span style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">Each basic source character set member in a character literal or a string literal, as well as each escape sequence and </span><i style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)"><a href="http://eel.is/c++draft/lex#nt:universal-character-name" style="text-decoration-line:none">universal-character-name</a></i><span style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)"> in a character literal or a non-raw string literal, is converted to the corresponding member of the execution character set (</span><a href="http://eel.is/c++draft/lex#ccon" style="text-decoration-line:none;font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">[lex.ccon]</a><span style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">, </span><a href="http://eel.is/c++draft/lex#string" style="text-decoration-line:none;font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">[lex.string]</a><span style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">); if there is no corresponding member, it is converted to an </span><span class="gmail-indexparent" style="display:inline;float:right;color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)"></span><span style="color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">implementation-defined member other than the null (wide) character</span><a class="gmail-hidden_link" href="http://eel.is/c++draft/lex#phases-1.5.sentence-1" style="text-decoration-line:none;color:inherit;font-family:serif;font-size:medium;text-align:justify;background-color:rgb(201,251,201)">.</a><a class="gmail-footnotenum" href="http://eel.is/c++draft/lex#footnote-8" id="gmail-footnoteref-8" style="text-decoration-line:none;vertical-align:super;font-size:smaller;line-height:0;font-family:serif;text-align:justify;background-color:rgb(201,251,201)">8</a>  

<a href="http://eel.is/c++draft/lex#phases-1.5">http://eel.is/c++draft/lex#phases-1.5</a> <br><br>I agree, though, that avoiding the execution character set and current locale is very common. I do a lot of work on international text, and everything has to be dealt with explicitly, although unicode and UTF-8 is by far the easiest way. <br><br>Implicit is bad.  <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 13, 2019 at 4:34 PM &lt;<a href="mailto:keld@keldix.com">keld@keldix.com</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">For most programs there is no default execution character set nor default<br>
execution encoding. A binary program is designed to run with the run time<br>
execution character set of the locale it runs with. So the same binary <br>
řogram can run with a Japanese encoding or a Danish enoding or arabic encoding.<br>
There is no knowledge at compilation time what encoding will be used at run time.<br>
<br>
<br>
keld<br>
<br>
On Tue, Aug 13, 2019 at 04:10:29PM -0400, Steve Downey wrote:<br>
&gt; Getting back to the original question. I think execution character set and<br>
&gt; execution encoding would refer to the encoding specified by the default<br>
&gt; locale, the &quot;C&quot; locale. We do not change the execution encoding via calls<br>
&gt; to setlocale(), we change the global default locale to a new locale.<br>
&gt; <br>
&gt; Any name is going to be confusing. I think it&#39;s better to just get an<br>
&gt; explicit definition to go together with the term. Something like that the<br>
&gt; execution encoding is the same as the default character set associated with<br>
&gt; the default &quot;C&quot; locale, and that it is IF NDR if the actual default<br>
&gt; character set is different than the presumed translation from source<br>
&gt; encoding to execution encoding, or if translation units with different<br>
&gt; execution encodings are linked together.  IF NDR because I don&#39;t see how it<br>
&gt; could always be detected but it can quickly turn into ODR violations where<br>
&gt; the same named object has different definitions.<br>
&gt; <br>
&gt; On Tue, Aug 13, 2019 at 1:22 PM Corentin &lt;<a href="mailto:corentin.jabot@gmail.com" target="_blank">corentin.jabot@gmail.com</a>&gt; wrote:<br>
&gt; <br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On Tue, Aug 13, 2019, 7:08 PM Thiago Macieira &lt;<a href="mailto:thiago@macieira.org" target="_blank">thiago@macieira.org</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; On Tuesday, 13 August 2019 09:55:07 PDT Corentin wrote:<br>
&gt; &gt;&gt; &gt; (if anyone is thinking about that, I don&#39;t recommend it. You&#39;re going<br>
&gt; &gt;&gt; to run<br>
&gt; &gt;&gt; &gt; into size limits: ICC at 512kB and MSVC at 256kB. Use something like<br>
&gt; &gt;&gt; xxd -i<br>
&gt; &gt;&gt; &gt; to generate a brace-delimited array instead)<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; Afaik that works if you use \x to escape every byte otherwise some<br>
&gt; &gt;&gt; &gt; implementation will mess with your data. Nothing is guaranteed to be<br>
&gt; &gt;&gt; &gt; passthrough otherwise<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; That would be ideal, but the problem I had was the unavailability of<br>
&gt; &gt;&gt; proper<br>
&gt; &gt;&gt; tools to convert the input into a form that the C++ compiler could<br>
&gt; &gt;&gt; consume. I<br>
&gt; &gt;&gt; was trying to do with a simple concatenation of a header, data, and<br>
&gt; &gt;&gt; footer.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; The end result is a shell script, a Perl script and a powershell script:<br>
&gt; &gt;&gt;         <a href="https://codereview.qt-project.org/c/qt/qtbase/+/263548" rel="noreferrer" target="_blank">https://codereview.qt-project.org/c/qt/qtbase/+/263548</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Interesting ! std::embed could be useful there (we are going a bit off<br>
&gt; &gt; script). Some kind of raw bytes literals or an implementation that would<br>
&gt; &gt; optimize parsing arrays of literals such that it is as efficient at compile<br>
&gt; &gt; time as strings would also be nice.<br>
&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; --<br>
&gt; &gt;&gt; Thiago Macieira - thiago (AT) <a href="http://macieira.info" rel="noreferrer" target="_blank">macieira.info</a> - thiago (AT) <a href="http://kde.org" rel="noreferrer" target="_blank">kde.org</a><br>
&gt; &gt;&gt;    Software Architect - Intel System Software Products<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; _______________________________________________<br>
&gt; &gt; SG16 Unicode mailing list<br>
&gt; &gt; <a href="mailto:Unicode@isocpp.open-std.org" target="_blank">Unicode@isocpp.open-std.org</a><br>
&gt; &gt; <a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; SG16 Unicode mailing list<br>
&gt; <a href="mailto:Unicode@isocpp.open-std.org" target="_blank">Unicode@isocpp.open-std.org</a><br>
&gt; <a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
<br>
</blockquote></div>