diff options
-rw-r--r-- | fietsboek/data.py | 2 | ||||
-rw-r--r-- | fietsboek/pages.py | 2 | ||||
-rw-r--r-- | fietsboek/scripts/fietsctl.py | 2 | ||||
-rw-r--r-- | fietsboek/updater/__init__.py | 2 | ||||
-rw-r--r-- | fietsboek/util.py | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/fietsboek/data.py b/fietsboek/data.py index 96acaec..1a1b66b 100644 --- a/fietsboek/data.py +++ b/fietsboek/data.py @@ -64,7 +64,7 @@ class DataManager: :return: The maintenance mode state. """ try: - return (self.data_dir / "MAINTENANCE").read_text() + return (self.data_dir / "MAINTENANCE").read_text(encoding="utf-8") except FileNotFoundError: return None diff --git a/fietsboek/pages.py b/fietsboek/pages.py index 8baf02b..5ca8f24 100644 --- a/fietsboek/pages.py +++ b/fietsboek/pages.py @@ -149,7 +149,7 @@ class Pages: :param path: The path of the file to load. :raises PageException: If the page is malformed. """ - source = path.read_text() + source = path.read_text(encoding="utf-8") try: page = Page.parse(source) except PageException as exc: diff --git a/fietsboek/scripts/fietsctl.py b/fietsboek/scripts/fietsctl.py index a1f14f7..2d6302e 100644 --- a/fietsboek/scripts/fietsctl.py +++ b/fietsboek/scripts/fietsctl.py @@ -153,7 +153,7 @@ def cmd_maintenance_mode(env, args): elif args.disable: (data_manager.data_dir / "MAINTENANCE").unlink() else: - (data_manager.data_dir / "MAINTENANCE").write_text(args.reason) + (data_manager.data_dir / "MAINTENANCE").write_text(args.reason, encoding="utf-8") return EXIT_OKAY diff --git a/fietsboek/updater/__init__.py b/fietsboek/updater/__init__.py index 8eca10d..a62b395 100644 --- a/fietsboek/updater/__init__.py +++ b/fietsboek/updater/__init__.py @@ -387,7 +387,7 @@ def _load_update_scripts(): """Loads all available import scripts.""" files = importlib_resources.files(__name__) / "scripts" return [ - UpdateScript(file.read_text(), _filename_to_modname(file.name)) + UpdateScript(file.read_text(encoding="utf-8"), _filename_to_modname(file.name)) for file in files.iterdir() if file.name.startswith("upd_") ] diff --git a/fietsboek/util.py b/fietsboek/util.py index 8dd81c0..96ba660 100644 --- a/fietsboek/util.py +++ b/fietsboek/util.py @@ -314,7 +314,7 @@ def read_localized_resource( locale_dir = importlib_resources.files(package) / "locale" / locale resource_path = locale_dir / path try: - return resource_path.read_text() + return resource_path.read_text(encoding="utf-8") except (FileNotFoundError, ModuleNotFoundError, NotADirectoryError): pass if raise_on_error: |