Skip to content

Fix: The report is saved without following the UTF-8 encoding #564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pytest_html/html_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ 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)
style_path.write_text(self.style_css, encoding="utf-8")

def _post_process_reports(self):
for test_name, test_reports in self.reports.items():
Expand Down