From ed58b637120293f0e9d381c077c4dc754ecba48a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 31 Aug 2013 13:17:57 +0200 Subject: [PATCH] Preprocessor: improved handling when file starts with 0xff or 0xfe that is not part of a BOM --- lib/preprocessor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 92cdfaf0c..00e72ddf4 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -167,6 +167,8 @@ std::string Preprocessor::read(std::istream &istr, const std::string &filename) bom = ((unsigned int)istr.get() << 8); if (istr.peek() >= 0xfe) bom |= (unsigned int)istr.get(); + else + bom = 0; // allowed boms are 0/0xfffe/0xfeff } if (_settings && _settings->terminated())