Function std::utf8_len
unsigned long utf8_len(const &char s)Counts codepoints (not bytes) in a NUL-terminated, well-formed UTF-8 string. Returns 0 if the string is not valid UTF-8 (use utf8_is_valid first if you need to distinguish that from a genuinely empty string).