Skip to content

Commit

Permalink
fix: open files with utf-8 encoding for windows
Browse files Browse the repository at this point in the history
full description of the issue: #42
  • Loading branch information
guilatrova committed Dec 31, 2021
1 parent 2a6043c commit a46636c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tryceratops/files/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def parse_tree(content: TextIO) -> ast.AST:


def parse_file(filename: str) -> Tuple[ast.AST, FileFilter]:
with open(filename, "r") as content:
with open(filename, "r", encoding="utf-8") as content:
tree = parse_tree(content)

content.seek(0)
Expand Down
2 changes: 1 addition & 1 deletion src/tryceratops/fixers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class FileFixerHandler:
def __init__(self, filename: str):
self.file = open(filename, "r+")
self.file = open(filename, "r+", encoding="utf-8")

def __enter__(self):
return self
Expand Down

0 comments on commit a46636c

Please sign in to comment.