From: Ketmar Dark Date: Sun, 10 Feb 2019 13:39:22 +0000 (+0200) Subject: skip idiotic BOM in text parser X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=05494fe1320ebc427c3b5c688c18669bf3abc260;p=d2df-sdl.git skip idiotic BOM in text parser --- diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas index de2dfb3..595d300 100644 --- a/src/shared/xparser.pas +++ b/src/shared/xparser.pas @@ -306,6 +306,14 @@ begin mTokInt := 0; mOptions := aopts; skipToken(); + // fuck you, BOM! + { + if (mBufLen >= 3) and (mBuffer[0] = #$EF) and (mBuffer[1] = #$BB) and (mBuffer[2] = #$BF) then + begin + for f := 3 to mBufLen-1 do mBuffer[f-3] := mBuffer[f]; + Dec(mBufLen, 3); + end; + } end; @@ -426,6 +434,17 @@ function TTextParser.skipBlanks (): Boolean; var level: Integer; begin + //writeln('line=', mLine, '; col=', mCol, '; char0=', Integer(peekChar(0))); + if (mLine = 1) and (mCol = 1) and + (peekChar(0) = #$EF) and + (peekChar(1) = #$BB) and + (peekChar(2) = #$BF) then + begin + skipChar(); + skipChar(); + skipChar(); + end; + while (curChar <> #0) do begin if (curChar = '/') then