From bac93b95ab3b06af20d264bf7b81b53063de3e41 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:23:18 +0900 Subject: [PATCH] fix: specify utf-8 explicitly --- pytaxonomies/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytaxonomies/api.py b/pytaxonomies/api.py index 30da7a1..6494973 100644 --- a/pytaxonomies/api.py +++ b/pytaxonomies/api.py @@ -270,7 +270,7 @@ class Taxonomies(abc.Mapping): # type: ignore raise ImportError('jsonschema is required: pip install jsonschema') if sys.modules['pytaxonomies'].__file__: schema = os.path.join(os.path.abspath(os.path.dirname(sys.modules['pytaxonomies'].__file__)), 'data', 'misp-taxonomies', 'schema.json') - with open(schema, 'r') as f: + with open(schema, 'r', encoding="utf-8") as f: loaded_schema = json.load(f) for t in self.values(): jsonschema.validate(t.taxonomy, loaded_schema) @@ -278,7 +278,7 @@ class Taxonomies(abc.Mapping): # type: ignore def __load_path(self, path: Union[Path, str]) -> Dict[str, Any]: if isinstance(path, str): path = Path(path) - with path.open('r') as f: + with path.open('r', encoding="utf-8") as f: return json.load(f) def __load_url(self, url: str) -> Dict[str, Any]: