From 8529dc39c348411ed5177fe281f18a456680f803 Mon Sep 17 00:00:00 2001 From: trialhub123 <70243751+trialhub123@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:31:05 -0500 Subject: [PATCH] fix UnicodeEncodeError occured when reports generated with special chars (#90) Co-authored-by: shreyas4111 --- HtmlTestRunner/result.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HtmlTestRunner/result.py b/HtmlTestRunner/result.py index 9ec9a67..0289c9a 100644 --- a/HtmlTestRunner/result.py +++ b/HtmlTestRunner/result.py @@ -400,7 +400,7 @@ def generate_file(self, testRunner, report_name, report): path_file = os.path.abspath(os.path.join(dir_to, report_name)) self.stream.writeln(os.path.relpath(path_file)) self.report_files.append(path_file) - with open(path_file, 'w') as report_file: + with open(path_file, 'w', encoding='utf-8') as report_file: report_file.write(report) def _exc_info_to_string(self, err, test):