Skip to content

Commit e5e6575

Browse files
committed
utf-8 bom support.
1 parent 3745d79 commit e5e6575

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

pep8.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,9 @@ def __init__(self, filename=None, lines=None,
11981198
self.lines = []
11991199
else:
12001200
self.lines = lines
1201+
bom = '\xEF\xBB\xBF'
1202+
if len(self.lines) and self.lines[0].startswith(bom):
1203+
self.lines[0] = self.lines[0][len(bom):]
12011204
self.report = report or options.report
12021205
self.report_error = self.report.error
12031206

testsuite/utf-8-bom.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
hello = 'こんにちわ'
5+
6+
# EOF

0 commit comments

Comments
 (0)