diff --git a/src/pytest_html/html_report.py b/src/pytest_html/html_report.py index 045c52c1..7c620216 100644 --- a/src/pytest_html/html_report.py +++ b/src/pytest_html/html_report.py @@ -256,7 +256,7 @@ def _save_report(self, report_content): if not self.self_contained: assets_dir.mkdir(parents=True, exist_ok=True) - self.logfile.write_text(report_content) + self.logfile.write_text(report_content, encoding="utf-8") if not self.self_contained: style_path = assets_dir / "style.css" style_path.write_text(self.style_css)