X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fcharset%2Fcharset.h;h=907b9e09bb5268ef116150f6e8916667392b2397;hp=257d2860d70122efb407ae2d4d49b84015f72dcc;hb=12af7e37d7da88f23679c7d3e6962817cd6f18c3;hpb=06c4af3163e2bd99999a93a478d1308ea39c5a79 diff --git a/ccan/charset/charset.h b/ccan/charset/charset.h index 257d2860..907b9e09 100644 --- a/ccan/charset/charset.h +++ b/ccan/charset/charset.h @@ -42,6 +42,16 @@ typedef uint32_t uchar_t; */ bool utf8_validate(const char *str, size_t length); +/* + * Validate a single UTF-8 character. + * @s: Beginning of UTF-8 character. + * @e: End of string. + * + * If it's valid, return its length (1 thru 4). + * If it's invalid or clipped, return 0. + */ +int utf8_validate_char(const char *s, const char *e); + /* * Read a single UTF-8 character starting at @s, * returning the length, in bytes, of the character read.