From 4be04548c80a807039bd77b759067e12f8d9ff0c Mon Sep 17 00:00:00 2001 From: Ryo Takahashi Date: Mon, 20 Jul 2015 22:57:15 +0900 Subject: [PATCH] remove bom --- cpplint/cpplint.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index ccc25d4..bf95cad 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -6160,6 +6160,12 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]): else: lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n') + # Remove BOM + if lines and lines[0]: + ord0 = ord(lines[0][0]) + if ord0 == 0xfeff: + lines[0] = lines[0][1:] + # Remove trailing '\r'. # The -1 accounts for the extra trailing blank line we get from split() for linenum in range(len(lines) - 1):