utf8: add function to detect prohibited UTF-16/32 BOM
[gitweb.git] / utf8.h
diff --git a/utf8.h b/utf8.h
index 6bbcf31a831d60faf119fdc3f82f1eb10233e255..0db1db4519aefd1e52c0a8ea1b618f5dde513d38 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -70,4 +70,13 @@ typedef enum {
 void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int width,
                       const char *s);
 
+/*
+ * If a data stream is declared as UTF-16BE or UTF-16LE, then a UTF-16
+ * BOM must not be used [1]. The same applies for the UTF-32 equivalents.
+ * The function returns true if this rule is violated.
+ *
+ * [1] http://unicode.org/faq/utf_bom.html#bom10
+ */
+int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
+
 #endif