C++ Logo

sg16

Advanced search

Re: [isocpp-lib] Why have we deprecated filesystem::u8path?

From: Peter Dimov <pdimov_at_[hidden]>
Date: Tue, 29 Nov 2022 13:33:24 +0200
Steve Downey wrote:
> If I recall correctly, and it's been a while, so underlying details are fuzzy.
>
> Filesystems in general, and in particular NTFS, don't actually maintain any
> unicode invariants. The sequence of octets you get from the file system for a
> path may not be a well formed utf-8 string. The only thing that will open the
> same file is the same set of octets used to open it in the first place, ...

You don't get octets from NTFS, you get char16_t[]. It doesn't care about
stray surrogates, so that may be invalid UTF-16. If you encode it to UTF-8,
you get something called WTF-8. (Really.)

Received on 2022-11-29 11:33:27