Skip to content

Commit e65d581

Browse files
committed
Merge pull request #193 from sporty/master
utf-8 BOM support
2 parents ee9903d + e5e6575 commit e65d581

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
@@ -1200,6 +1200,9 @@ def __init__(self, filename=None, lines=None,
12001200
self.lines = []
12011201
else:
12021202
self.lines = lines
1203+
bom = '\xEF\xBB\xBF'
1204+
if len(self.lines) and self.lines[0].startswith(bom):
1205+
self.lines[0] = self.lines[0][len(bom):]
12031206
self.report = report or options.report
12041207
self.report_error = self.report.error
12051208

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)