For example:
s = “兰蔻面膜” In Python, its length is:
>>> len(“兰蔻面膜”) 4 But in C++, len=12 as below:
cout<< s.length()<<endl; 12 Why is that? I am simply checking the length of Chinese string in c++ IDE, and found its length is 12. The 's' has 4 characters.
len("兰蔻面膜".encode("utf8"))is 12.L"👨🌾",L"👨👩👦👦",L"👩🏻❤️💋👩🏿",L"🇪🇺",L"Å",L"각",L"நி",L"षि",L"👧🏻",L"❤️",L"é"... to see if any of them has length = 1 even whensizeof(wchar_t) == 4. UTF-32 doesn't mean fixed-length characters