diff --git a/capa/helpers.py b/capa/helpers.py index f7978b54..796a00ce 100644 --- a/capa/helpers.py +++ b/capa/helpers.py @@ -52,7 +52,7 @@ def assert_never(value) -> NoReturn: def get_format_from_report(sample: Path) -> str: - report = json.load(sample.open()) + report = json.load(sample.open(encoding="utf-8")) if "CAPE" in report: return FORMAT_CAPE return FORMAT_UNKNOWN diff --git a/capa/main.py b/capa/main.py index cb0d5459..50dc0f88 100644 --- a/capa/main.py +++ b/capa/main.py @@ -751,7 +751,7 @@ def get_extractor( if format_ == FORMAT_CAPE: import capa.features.extractors.cape.extractor - report = json.load(Path(path).open()) + report = json.load(Path(path).open(encoding="utf-8")) return capa.features.extractors.cape.extractor.CapeExtractor.from_report(report) elif format_ == FORMAT_DOTNET: @@ -827,7 +827,7 @@ def get_file_extractors(sample: Path, format_: str) -> List[FeatureExtractor]: file_extractors.append(capa.features.extractors.elffile.ElfFeatureExtractor(sample)) elif format_ == FORMAT_CAPE: - report = json.load(Path(sample).open()) + report = json.load(Path(sample).open(encoding="utf-8")) file_extractors.append(capa.features.extractors.cape.extractor.CapeExtractor.from_report(report)) return file_extractors