<div dir="ltr"><div dir="ltr"><br></div><div dir="ltr">Chiming in with my favorite solution:<br></div><div dir="ltr"><ul><li>Forbid lossy source -> presumed execution encoding conversion (all ready ill formed in gcc but not msvc)</li><li>Forbid u8/u16/u32 literals in non unicode encoded files</li><li>Expose the "presumed execution encoding" (= "narrow/wide character literal encoding") as a consteval function returning the name as specified by iana <a href="https://www.iana.org/assignments/character-sets/character-sets.txt">https://www.iana.org/assignments/character-sets/character-sets.txt</a></li></ul><div>I would expect changing the encoding of char would break everything... I'd leave char and wchar_t mostly alone and start clean on char8_t.</div><div><br></div><div>Anyhow, I agree with Tom that the names are not indicative</div><div>How about: "narrow/wide character literal encoding" ?</div><div><br></div><div><br></div></div><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 13 Aug 2019 at 10:39, Niall Douglas <<a href="mailto:s_sourceforge@nedprod.com">s_sourceforge@nedprod.com</a>> 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">Before progressing with a solution, can I ask the question:<br>
<br>
Is it politically feasible for C++ 23 and C 2x to require<br>
implementations to default to interpreting source files as either (i) 7<br>
bit ASCII or (ii) UTF-8? To be specific, char literals would thus be<br>
either 7 bit ASCII or UTF-8.<br>
<br>
(The reason for the 7 bit ASCII is that it is a perfect subset of UTF-8,<br>
and that C very much wants to retain the language being implementable in<br>
a small code base i.e. without UTF-8 support. Note the qualifier<br>
"default" as well)<br>
<br>
An answer to the above would determine how best to solve your issue Tom,<br>
I think. As much as we all expect IBM et al to veto such a proposal, one<br>
never gets anywhere without asking first.<br>
<br>
Niall<br>
<br>
On 13/08/2019 03:25, Tom Honermann wrote:<br>
> I agree with this (mostly), but would prefer not to discuss further in<br>
> this thread. The only reason I included the filesystem references is<br>
> because the wording there uses "native" for an encoding that is related<br>
> (though distinct) from the encodings referenced in the codecvt and ctype<br>
> wording, where "native" is also used. This suggests that "native"<br>
> serves (or should serve) a role in naming these run-time encodings, or<br>
> is a source of conflation (or both).<br>
> <br>
> Tom.<br>
> <br>
> On 8/12/19 5:08 PM, Niall Douglas wrote:<br>
>>> 1. [fs.path.type.cvt]p1 <<a href="http://eel.is/c++draft/fs.path.type.cvt#1" rel="noreferrer" target="_blank">http://eel.is/c++draft/fs.path.type.cvt#1</a>>:<br>
>>> (though the definition provided here appears to be specific to path<br>
>>> names).<br>
>>> "The /native encoding/ of an ordinary character string is the<br>
>>> operating system dependent current encoding for path names. The<br>
>>> /native encoding/ for wide character strings is the<br>
>>> implementation-defined execution wide-character set encoding."<br>
>> We discussed the problems with the choice of normative wording in<br>
>> <a href="http://eel.is/c++draft/fs.class.path#fs.path.cvt" rel="noreferrer" target="_blank">http://eel.is/c++draft/fs.class.path#fs.path.cvt</a>, if you remember,<br>
>> during SG16's discussion of filesystem::path_view.<br>
>><br>
>> The problem is that filesystem paths have different encoding and<br>
>> interpretation per-path-component i.e. for a path<br>
>><br>
>> /A/B/C/D<br>
>><br>
>> ... A, B, C and D may each have its own, individual, encoding and<br>
>> interpretation depending on the mount points and filesystems configured<br>
>> on the current system. This is not what is suggested by the current<br>
>> normative wording, which appears to think that some mapping exists<br>
>> between C++ paths and OS kernel paths.<br>
>><br>
>> There *is* a mapping, but it is 100% C++-side. The OS kernel generally<br>
>> consumes arrays of bytes.<br>
>><br>
>> A more correct normative wording would more clearly separate these two<br>
>> kinds of path representation. OS kernel paths are arrays of `byte`, but<br>
>> with certain implementation-defined byte sequences not permitted. C++<br>
>> paths can be in char, wchar_t, char8_t, char16_t, char32_t etc, and<br>
>> there are well defined conversions between those C++ paths and the array<br>
>> of bytes supplied to the OS kernel. The standard can say nothing useful<br>
>> about how the OS kernel may interpret the byte array C++ supplies to it.<br>
>><br>
>> If path_view starts the standards track, I'll need to propose a document<br>
>> fixing up <a href="http://eel.is/c++draft/fs.class.path#fs.path.cvt" rel="noreferrer" target="_blank">http://eel.is/c++draft/fs.class.path#fs.path.cvt</a> in any case.<br>
>> But to come back to your original question, I think that you ought to<br>
>> split off filesystem paths from everything else, consider them separate,<br>
>> and then I think you'll find it much easier to make the non-path<br>
>> normative wording more consistent.<br>
>><br>
>> Niall<br>
>> _______________________________________________<br>
>> SG16 Unicode mailing list<br>
>> <a href="mailto:Unicode@isocpp.open-std.org" target="_blank">Unicode@isocpp.open-std.org</a><br>
>> <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>
> <br>
_______________________________________________<br>
SG16 Unicode mailing list<br>
<a href="mailto:Unicode@isocpp.open-std.org" target="_blank">Unicode@isocpp.open-std.org</a><br>
<a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
</blockquote></div></div>