always state encoding when opening files in text mode

Also applies to Path.write_text().
This commit is contained in:
Sarah Hoffmann
2022-05-10 15:36:29 +02:00
parent adeebec32a
commit 7e70e5f503
3 changed files with 3 additions and 3 deletions

View File

@@ -187,7 +187,7 @@ class Configuration:
if configfile.suffix in ('.yaml', '.yml'):
result = self._load_from_yaml(configfile)
elif configfile.suffix == '.json':
with configfile.open('r') as cfg:
with configfile.open('r', encoding='utf-8') as cfg:
result = json.load(cfg)
else:
raise UsageError(f"Config file '{configfile}' has unknown format.")