C++ Logo

sg16

Advanced search

Re: [isocpp-sg16] UTF-8 support status

From: Alisdair Meredith <alisdairm_at_[hidden]>
Date: Tue, 7 Jul 2026 12:21:58 -0400
> On Jul 2, 2026, at 11:48 PM, Thiago Macieira via SG16 <sg16_at_[hidden]> wrote:
>
> On Thursday, 2 July 2026 20:01:55 Pacific Daylight Time Victor Zverovich via
> SG16 wrote:
>> Moreover, ACP is mostly irrelevant in modern code and it's sufficient to
>> compile with /utf-8 on MSVC (and on most other systems UTF-8 is the default
>> for char).
>
> That's not correct. That causes the compiler to interpret the source input as
> UTF-8 and emit narrow character literals as UTF-8. It does not change how the
> narrow character APIs behave at runtime.
>
> To do that, you need to set the manifest flag that Tony mentioned. And only the
> application (a.k.a. the owner of main()) can do that. Library code cannot and
> must therefore cope with being run with another ACP. It could declare other
> ACPs are not supported, but that would limit the audience of the library, as
> most applications do not set the flag for some reason or another, including but
> not limited to simply not knowing about it.

I remember a few years back some folks were advocating using `std::filesystem::path`
as their basic string type, as its wrapped “native” string would be the most appropriate
representation on a given platform at runtime.

That is not necessarily an answer for Unicode, but an indicator of how creative users
have become trying to work around some of the issues of portable strings.

AlisdairM

Received on 2026-07-07 16:22:46