Skip to content

Commit

Permalink
Merge pull request #526 from urbasus/urbasus-patch-1
Browse files Browse the repository at this point in the history
Open file using transparent encoding/decoding
  • Loading branch information
jacebrowning committed Mar 9, 2022
2 parents 054bc92 + e001850 commit 541f5b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doorstop/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Common exceptions, classes, and functions for Doorstop."""

import argparse
import codecs
import csv
import glob
import logging
Expand Down Expand Up @@ -112,7 +113,7 @@ def read_text(path):
"""
log.trace("reading text from '{}'...".format(path)) # type: ignore
try:
with open(path, "r", encoding="utf-8") as f:
with codecs.open(path, "r", encoding="utf-8") as f:
return f.read()
except Exception as e:
msg = "reading '{}' failed: {}".format(path, e)
Expand Down

0 comments on commit 541f5b5

Please sign in to comment.