Skip to content

Commit

Permalink
fix: open text file with utf8 encoding, for Windows
Browse files Browse the repository at this point in the history
On Windows, with the default encoding not typically utf-8,
create_input_tei() would read the file in the wrong encoding and corrupt
it for downstream processing. Fix: explicitly declare the encoding we
want to read with.
  • Loading branch information
joanise committed Aug 24, 2021
1 parent b72b5de commit 7e4390f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion readalongs/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def create_input_tei(**kwargs):
str: output file name
"""
if kwargs.get("input_file_name", False):
with io.open(kwargs["input_file_name"]) as f:
with io.open(kwargs["input_file_name"], encoding="utf8") as f:
text = f.readlines()
elif kwargs.get("input_file_handle", False):
text = kwargs["input_file_handle"].readlines()
Expand Down

0 comments on commit 7e4390f

Please sign in to comment.