Reputation: 367
I can create a UTF-8 string in C++ like this:
char str[] = u8"a UTF-8 string literal";
But does the C++ standard library have UTF-8 functions? for example, does it have a function to get the number of characters that a UTF-8 string have?
Upvotes: 3
Views: 829
Reputation: 62583
C++ Standard used to have various utf8 conversion routines, specified in codecvt
. But they are deprecated since C++17. A bit of rationale can be found in http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0618r0.html, in particular:
The contents of are underspecified, and will take a reasonable amount of work to identify and correct all of the issues. There appears to be a general feeling that this is not the best way to address unicode transcoding in the first place, and this library component should be retired to Annex D, along side , until a suitable replacement is standardized.
Upvotes: 3