]> git.ozlabs.org Git - ccan/blobdiff - ccan/charset/charset.h
charset: Added utf8_validate_char (factored out of utf8_validate).
[ccan] / ccan / charset / charset.h
index 257d2860d70122efb407ae2d4d49b84015f72dcc..907b9e09bb5268ef116150f6e8916667392b2397 100644 (file)
@@ -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.