Hi Bram!
On Do, 28 Jul 2011, Bram Moolenaar wrote:
>
> Christian Brabandt wrote:
>
> > Hi Bram,
> >
> > attached patch fixes this issue from the todo list:
> >
> > ,----
> > | Recognize and ignore BOM in error file. (Aleksey Baibarin)
> > `----
>
> The patch was empty...
I wonder how that happened.
Anyway here is the patch again.
regards
Christian
--
Überlasse das Hassen jenen, die zu schwach sind, um lieben zu können.
-- Michel del Castillo
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
# HG changeset patch
# Parent 2fa3ad1460ab66f9eddba65ff4fbf7ab5a880255
Skip BOM from errorfile
diff --git a/src/quickfix.c b/src/quickfix.c
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -249,6 +249,9 @@
{'v', "\\d\\+"},
{'s', ".\\+"}
};
+#ifdef FEAT_MBYTE
+ int check_bomb = TRUE;
+#endif
namebuf = alloc(CMDBUFFSIZE + 1);
errmsg = alloc(CMDBUFFSIZE + 1);
@@ -560,6 +563,22 @@
else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL)
break;
+#ifdef FEAT_MBYTE
+ /* it should be safe to use the len variable */
+ len = STRLEN(IObuff);
+ if (check_bomb
+ && STRLEN(IObuff) >= 3
+ && enc_utf8
+ && IObuff[0] == 0xef
+ && IObuff[1] == 0xbb
+ && IObuff[2] == 0xbf)
+ /* remove utf-8 byte order mark from file */
+ {
+ mch_memmove(IObuff, IObuff+3, len - 3);
+ IObuff[len-3] = NUL;
+ check_bomb = FALSE;
+ }
+#endif
IObuff[CMDBUFFSIZE - 2] = NUL; /* for very long lines */
if ((efmp = vim_strrchr(IObuff, '\n')) != NULL)
*efmp = NUL;