Imported Upstream version 2.4.1
[platform/upstream/git.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 520fbb4..28e6d76 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;
+}