Merge branch 'jk/diagnose-config-mmap-failure' into maint
[gitweb.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 520fbb4994ab1bdcfa0bc4589a0ca5131a89c490..28e6d76a425db4c16a8cc32e6f17c7aa72c2b1f0 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -633,3 +633,14 @@ int is_hfs_dotgit(const char *path)
 
        return 1;
 }
+
+const char utf8_bom[] = "\357\273\277";
+
+int skip_utf8_bom(char **text, size_t len)
+{
+       if (len < strlen(utf8_bom) ||
+           memcmp(*text, utf8_bom, strlen(utf8_bom)))
+               return 0;
+       *text += strlen(utf8_bom);
+       return 1;
+}