diff src/mbyte.c @ 3002:7d4e5e31d8c1 v7.3.273

updated for version 7.3.273 Problem: A BOM in an error file is seen as text. (Aleksey Baibarin) Solution: Remove the BOM from the text before evaluating. (idea by Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Wed, 10 Aug 2011 13:21:46 +0200
parents 25be7c9dda54
children 54ef99c39139
line wrap: on
line diff
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -838,6 +838,27 @@ bomb_size()
 }
 
 /*
+ * Remove all BOM from "s" by moving remaining text.
+ */
+    void
+remove_bom(s)
+    char_u *s;
+{
+    if (enc_utf8)
+    {
+	char_u *p = s;
+
+	while ((p = vim_strbyte(p, 0xef)) != NULL)
+	{
+	    if (p[1] == 0xbb && p[2] == 0xbf)
+		STRMOVE(p, p + 3);
+	    else
+		++p;
+	}
+    }
+}
+
+/*
  * Get class of pointer:
  * 0 for blank or NUL
  * 1 for punctuation