diff --git a/mitreattack/diffStix/changelog_helper.py b/mitreattack/diffStix/changelog_helper.py index fe88b70..9eeff6b 100644 --- a/mitreattack/diffStix/changelog_helper.py +++ b/mitreattack/diffStix/changelog_helper.py @@ -2429,7 +2429,7 @@ def get_new_changelog_md( if markdown_file: logger.info("Writing markdown to file") Path(markdown_file).parent.mkdir(parents=True, exist_ok=True) - with open(markdown_file, "w") as file: + with open(markdown_file, "w", encoding="utf-8") as file: file.write(md_string) if html_file: diff --git a/tests/changelog/integration/test_diffstix_output_generation.py b/tests/changelog/integration/test_diffstix_output_generation.py index 47ca399..9bb191b 100644 --- a/tests/changelog/integration/test_diffstix_output_generation.py +++ b/tests/changelog/integration/test_diffstix_output_generation.py @@ -155,7 +155,7 @@ def test_end_to_end_output_generation(self, minimal_stix_bundles, tmp_path, setu assert Path(layer_files[0]).exists() # Verify markdown file content - markdown_content = markdown_file.read_text() + markdown_content = markdown_file.read_text(encoding="utf-8") assert markdown_content == markdown_result assert "## Key" in markdown_content diff --git a/tests/changelog/test_utils.py b/tests/changelog/test_utils.py index cc0ef42..e97878a 100644 --- a/tests/changelog/test_utils.py +++ b/tests/changelog/test_utils.py @@ -230,7 +230,7 @@ def validate_markdown_file_content(file_path: Union[str, Path]) -> str: path_obj = Path(file_path) assert path_obj.exists(), f"Markdown file should exist at {file_path}" - content = path_obj.read_text() + content = path_obj.read_text(encoding="utf-8") assert_basic_markdown_structure(content) return content @@ -405,7 +405,7 @@ def validate_comprehensive_output_generation( # Validate markdown file content matches return value if "markdown" in file_paths: - file_content = Path(file_paths["markdown"]).read_text() + file_content = Path(file_paths["markdown"]).read_text(encoding="utf-8") assert file_content == markdown_result, "Markdown file content should match return value"