Skip to content

Commit

Permalink
Set encoding=utf-8 when reading files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Heath committed Dec 13, 2023
1 parent f91743c commit 24d1a11
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion procrastinate/contrib/django/migrations_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def list_migration_files() -> Iterable[Tuple[str, str]]:
Returns a list of filenames and file contents for all migration files
"""
return [
(p.name, p.read_text())
(p.name, p.read_text(encoding="utf-8"))
for p in importlib_resources.files("procrastinate.sql.migrations").iterdir()
if p.name.endswith(".sql")
]
Expand Down
2 changes: 1 addition & 1 deletion procrastinate/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, connector: connector_module.BaseConnector):
def get_schema() -> str:
return (
importlib_resources.files("procrastinate.sql") / "schema.sql"
).read_text()
).read_text(encoding="utf-8")

@staticmethod
def get_migrations_path() -> str:
Expand Down
2 changes: 1 addition & 1 deletion procrastinate/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def parse_query_file(query_file: str) -> Dict["str", "str"]:

def get_queries() -> Dict["str", "str"]:
return parse_query_file(
(importlib_resources.files("procrastinate.sql") / "queries.sql").read_text()
(importlib_resources.files("procrastinate.sql") / "queries.sql").read_text(encoding="utf-8")
)


Expand Down

0 comments on commit 24d1a11

Please sign in to comment.