C++ Logo

sg16

Advanced search

Re: [SG16-Unicode] Do we really need basic_text_view?

From: Tom Honermann <tom_at_[hidden]>
Date: Sun, 5 Aug 2018 15:43:16 -0400
Adding the SG16 list back in...

> On 08/04/2018 10:33 PM, Lyberta wrote:
> Tom Honermann:
>> I agree we need those transcoding functions.
> Since it is impossible to implement std::filesystem without them, they
> are already implemented in at least libstdc++, haven't checked other
> implementations yet.

The std::filesystem conversions don't necessarily convert as you might expect. For example, libstdc++ always assumes UTF-8 (not necessarily well-formed) for its 'char' based interfaces and performs no conversions for the `char` and u8path cases. Specifically, the following does not actually perform a conversion from the execution character encoding to UTF-8.

std::filesystem::path p = "text";
p.u8string();

>
>> An outstanding question
>> is, do we provide them as additional codecvt specializations
> I think codecvt was exceptionally badly designed. I think we need to
> split fundamental bits from text_view proposal into a separate proposal
> and then work on top of them.

Adding transcoding interfaces to text_view is yet another thing that has been on my todo list for a long time (https://github.com/tahonermann/text_view/issues/4).

Tom.

Received on 2018-08-05 21:43:20