Skip to content

Commit

Permalink
utf-8 bom support.
Browse files Browse the repository at this point in the history
  • Loading branch information
sporty committed Apr 29, 2013
1 parent 3745d79 commit e5e6575
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pep8.py
Expand Up @@ -1198,6 +1198,9 @@ def __init__(self, filename=None, lines=None,
self.lines = []
else:
self.lines = lines
bom = '\xEF\xBB\xBF'
if len(self.lines) and self.lines[0].startswith(bom):
self.lines[0] = self.lines[0][len(bom):]
self.report = report or options.report
self.report_error = self.report.error

Expand Down
6 changes: 6 additions & 0 deletions testsuite/utf-8-bom.py
@@ -0,0 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

hello = 'こんにちわ'

# EOF

0 comments on commit e5e6575

Please sign in to comment.