From 14c45c2118b93173b4a5e2871d410fb524851a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 18 Sep 2009 19:42:06 +0200 Subject: [PATCH] Preprocessor: Skip BOM --- src/preprocessor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/preprocessor.cpp b/src/preprocessor.cpp index bc663b67b..16171a170 100644 --- a/src/preprocessor.cpp +++ b/src/preprocessor.cpp @@ -343,6 +343,14 @@ std::string Preprocessor::removeComments(const std::string &str) for (std::string::size_type i = 0; i < str.length(); ++i) { char ch = str[i]; + if (i == 0 && str.size() > 3 && + (char)str[0] == (char)0xef && + (char)str[1] == (char)0xbb && + (char)str[2] == (char)0xbf) + { + i = 2; + continue; + } if (ch < 0) throw std::runtime_error("The code contains characters that are unhandled");