Date: Fri, 3 Jul 2026 05:43:54 +0200
>
>
>
> - In the standard, those types don’t seem to work with std::format and
> streams.
>
>
P3876R2 is working on that (or rather, making the first steps toward that
support by letting you use char8_t in std::to_chars). I doubt anyone cares
enough about <iostream> to make that work with char8_t given that it's
basically abandonedware. We don't add support to it for any of our new
types (and we can't without breaking ABI), so it just keeps getting worse
compared to <print> and <format>.
>
>
> What’s the current best guidance for adopting UTF-8 in C++ code?
>
Use char and make sure your environment is UTF-8. If you use char8_t,
you're doing it in spite of the lack of support, maybe in hopes of
future-proofing for when the standard will have better Unicode support. I
suspect things will improve drastically in C++29.
>
>
> - In the standard, those types don’t seem to work with std::format and
> streams.
>
>
P3876R2 is working on that (or rather, making the first steps toward that
support by letting you use char8_t in std::to_chars). I doubt anyone cares
enough about <iostream> to make that work with char8_t given that it's
basically abandonedware. We don't add support to it for any of our new
types (and we can't without breaking ABI), so it just keeps getting worse
compared to <print> and <format>.
>
>
> What’s the current best guidance for adopting UTF-8 in C++ code?
>
Use char and make sure your environment is UTF-8. If you use char8_t,
you're doing it in spite of the lack of support, maybe in hopes of
future-proofing for when the standard will have better Unicode support. I
suspect things will improve drastically in C++29.
Received on 2026-07-03 03:44:07
