summaryrefslogtreecommitdiff
path: root/src/mbyte.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2011-08-10 13:21:46 +0200
committerBram Moolenaar <Bram@vim.org>2011-08-10 13:21:46 +0200
commit836082d398eb1dff8fb9fc6227f70ea56044eeba (patch)
tree7a089cb141c3dd2add36024b3590eca6a1e5bd6f /src/mbyte.c
parent213b10a57e08cf4389c54084e7236837b2396bb7 (diff)
downloadvim-git-836082d398eb1dff8fb9fc6227f70ea56044eeba.tar.gz
updated for version 7.3.273v7.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)
Diffstat (limited to 'src/mbyte.c')
-rw-r--r--src/mbyte.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mbyte.c b/src/mbyte.c
index 44d89f794..da97b346f 100644
--- 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