Change readfile() to ignore byte order marks, unless in binary mode.
diff --git a/src/eval.c b/src/eval.c
index 8a26b66..5dfb7f2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -14267,6 +14267,20 @@
}
else if (buf[filtd] == NUL)
buf[filtd] = '\n';
+#ifdef FEAT_MBYTE
+ else if (buf[filtd] == 0xef
+ && enc_utf8
+ && filtd + 2 < buflen
+ && !binary
+ && buf[filtd + 1] == 0xbb
+ && buf[filtd + 2] == 0xbf)
+ {
+ /* remove utf-8 byte order mark */
+ mch_memmove(buf + filtd, buf + filtd + 3, buflen - filtd - 3);
+ --filtd;
+ buflen -= 3;
+ }
+#endif
}
if (readlen <= 0)
break;