From 836082d398eb1dff8fb9fc6227f70ea56044eeba Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 10 Aug 2011 13:21:46 +0200 Subject: 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) --- src/mbyte.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mbyte.c') diff --git a/src/mbyte.c b/src/mbyte.c index 44d89f794..da97b346f 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -837,6 +837,27 @@ bomb_size() return n; } +/* + * 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 -- cgit v1.2.1