<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 13, 2019, 10:34 PM  &lt;<a href="mailto:keld@keldix.com">keld@keldix.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The standard assumes there is one. It has to. You cannot not have an encoding.</div><div dir="auto">(Of  course it is broken but it&#39;s a very old assumption).</div><div dir="auto"><br></div><div dir="auto">Also there is no such thing as a Danish encoding or a Japanese encoding. There is a Danish locale and an encoding attached to that locale (utf8, iso 8859). The standard doesn&#39;t always makes the distinction - it should)</div><div dir="auto"><br></div><div dir="auto">But yeah, all of that precludes people to have non ASCII in there source as this is currently the only thing that will work portably.</div><div dir="auto"><br></div><div dir="auto">This is not inherent to C++ which is one reason other languages converged to utf8 as the default/only encoding.</div><div dir="auto">(The primary reason being the Unicode character set is actually useful to store text)</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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" rel="noreferrer">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" rel="noreferrer">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 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 noreferrer" target="_blank">macieira.info</a> - thiago (AT) <a href="http://kde.org" rel="noreferrer 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" rel="noreferrer">Unicode@isocpp.open-std.org</a><br>
&gt; &gt; <a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer 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" rel="noreferrer">Unicode@isocpp.open-std.org</a><br>
&gt; <a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
<br>
</blockquote></div></div></div>