From 1416e5daddc29a4b029178b86b88030dfcb11671 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Sat, 2 Jan 2021 09:07:41 +0800 Subject: [PATCH] Changed code for skipping UTF-8 BOM --- lex.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lex.c b/lex.c index 638cb0c..42fc878 100644 --- a/lex.c +++ b/lex.c @@ -524,19 +524,19 @@ int lex_internal(void) { top: c = getChar(); - // skip UTF-8 BOM - if (c == 0xEF && stream->lineno == 1 && stream->column == 2) { - stream->column--; +#ifndef BUILDING_DLL + // skip UTF-8 BOM marker + if (c == 0xEF) { c = getChar(); if (c == 0xBB) { c = getChar(); - stream->column--; - } - if (c == 0xBF) { - c = getChar(); - stream->column--; + if (c == 0xBF) { + stream->column -= 3; + goto top; + } } } +#endif switch(c) { case EOF: