aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 5941e50..858d972 100644
--- a/src/util.h
+++ b/src/util.h
@@ -63,3 +63,16 @@ int dup2atleast(int fd, int atleast);
*/
void msleep(int ms);
+
+/**
+ * Check whether a NUL-terminated string is encoded in UTF-8
+ *
+ * @param string The string
+ * @param allow_modified_nul Whether Modified UTF-8 is allowed, which allows a two-byte encoding for NUL
+ * @return Zero if good, -1 on encoding error
+ */
+#if defined(__GNUC__)
+__attribute__((pure))
+#endif
+int verify_utf8(const char* string, int allow_modified_nul);
+