6 ms·
It's best to avoid using std::wstring and other wchar_t-related facilities, as they are highly non-portable across different platforms. If you need to interact
by chirsz 6mo ago
It's best to avoid using std::wstring and other wchar_t-related facilities, as they are highly non-portable across different platforms. If you need to interact with the Win32 API, use char16_t and std::u16string, so that anyone knows it contains a UTF-16 encoded string and knows how to use and process it.
- ack_complete 6mo agoThe Windows API uses WCHAR = wchar_t, so if you use char16_t, you have to convert back and forth to avoid running afoul of strict aliasing rules. This imposes conversion costs without benefits; both using wchar_t directly or converting to/from UTF-8 are better.
- delta_p_delta_x 6mo agoOr, set up the manifest in your app[1], and just use UTF-8 and `std::string`/`std::string_view` everywhere. [1]: https://learn.microsoft.com/en-gb/windows/apps/design/globalizing/use-utf8-code-page https://learn.microsoft.com/en-gb/windows/apps/design/global...