I have two simple examples of "UTF-8,16" to get the length of a text as follow:
// UTF-8
string str = u8"az";
cout << str.length() << endl; // The reulst: 6
// UTF-16
wstring str= L"az"; // Also "u16string"
cout << str.length() << endl; // The reulst: 4
The length of the first example is "6" and the second one is "4" but it is supposed to be just "3" in both of them because it must deal with as characters.
I know that happened because it calculates the length of the string by "code units".
I there a way to get the correct length of "UTF-8,16" string?