Return the number of bytes in a UTF-8 character.
#include <ldap_utf8.h>
int ldap_x_utf8_charlen (
const char *p);
(IN) Points to the UTF-8 character.
Returns length in bytes of the UTF-8 character. (1-6). 0 is returned for an invalid character.
The length of the character is determined by looking only at the first byte of the UTF-8 character.
/* String starts with a 3-byte UTF-8 character. */
char utstr[] = { 0xe2U, 0x98U, 0xa0U, ’a’, ’b’, ’c’, 0 };
int n = ldap_x_utf8_charlen(utstr); /* Returns 3 */
n = ldap_x_utf8_charlen(utstr+4); /* ’b’ char. Returns 1 */