From c467f198c89573765e18bb5db93691cf405e03cb Mon Sep 17 00:00:00 2001 From: Emmanuelle Vargas-Gonzalez Date: Wed, 15 Jan 2020 14:15:08 -0500 Subject: [PATCH] add encoding to MemorySource load_from_file() --- stix2/datastore/memory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stix2/datastore/memory.py b/stix2/datastore/memory.py index eff914d..52bf4c8 100644 --- a/stix2/datastore/memory.py +++ b/stix2/datastore/memory.py @@ -359,8 +359,8 @@ class MemorySource(DataSource): return all_data - def load_from_file(self, file_path, version=None): - with io.open(os.path.abspath(file_path), "r") as f: + def load_from_file(self, file_path, version=None, encoding='utf-8'): + with io.open(os.path.abspath(file_path), "r", encoding=encoding) as f: stix_data = json.load(f) _add(self, stix_data, self.allow_custom, version)