Date: Sat, 30 Aug 2025 13:22:18 +0200
On Aug 26, 2025, at 8:57 PM, Tom Honermann <tom_at_[hidden]> wrote:
setlocale() doesn't affect the encoding used by Win32 "ANSI" functions; they will still use the Active Code Page. To fix that, you have to build your application with a manifest that sets the activeCodePage property to UTF-8 (or ensure that your users have set their region settings to enable the (beta option that requires administrative access) use of UTF-8 for the system locale).
It looks like I have missed that “minor” detail. Usually, I write portable code and don’t call Windows functions directly. It is actually C runtime library that supports this through setlocale (https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-170&viewFallbackFrom=vs-2019#utf-8-support at the bottom of the page). By extension I believe this to be true for the C++ runtime library, as well.
So, for portable C++ code there is a way to make Windows work with UTF-8.
We do have a proposal to improve access to command line arguments. See P3474 (std::arguments).
This would be great if this is UTF-8 on Windows.
Received on 2025-08-30 11:22:37