remove bom

This commit is contained in:
Ryo Takahashi 2015-07-20 22:57:15 +09:00
parent 43d738ab8b
commit 4be04548c8

6
cpplint/cpplint.py vendored
View File

@ -6160,6 +6160,12 @@ def ProcessFile(filename, vlevel, extra_check_functions=[]):
else: else:
lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n') 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'. # Remove trailing '\r'.
# The -1 accounts for the extra trailing blank line we get from split() # The -1 accounts for the extra trailing blank line we get from split()
for linenum in range(len(lines) - 1): for linenum in range(len(lines) - 1):