mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 12:34:17 +00:00
Open files as UTF-8
This commit is contained in:
parent
16ff195820
commit
54c0f8c937
6 changed files with 10 additions and 8 deletions
|
|
@ -14,12 +14,12 @@ def main(argv=None):
|
|||
|
||||
retv = 0
|
||||
for filename in args.files:
|
||||
original_contents = io.open(filename).read()
|
||||
original_contents = io.open(filename, encoding='UTF-8').read()
|
||||
new_contents = autopep8.fix_code(original_contents, args)
|
||||
if original_contents != new_contents:
|
||||
print('Fixing {}'.format(filename))
|
||||
retv = 1
|
||||
with io.open(filename, 'w') as output_file:
|
||||
with io.open(filename, 'w', encoding='UTF-8') as output_file:
|
||||
output_file.write(new_contents)
|
||||
|
||||
return retv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue