diff --git a/pytest_html/plugin.py b/pytest_html/plugin.py
index bd9ecb6f..c6da781a 100644
--- a/pytest_html/plugin.py
+++ b/pytest_html/plugin.py
@@ -104,7 +104,7 @@ def __init__(self, logfile, config):
class TestResult:
def __init__(self, outcome, report, logfile, config):
- self.test_id = report.nodeid
+ self.test_id = report.nodeid.encode("utf-8").decode("unicode_escape")
if getattr(report, "when", "call") != "call":
self.test_id = "::".join([report.nodeid, report.when])
self.time = getattr(report, "duration", 0.0)
diff --git a/testing/test_pytest_html.py b/testing/test_pytest_html.py
index c05b0615..d007f719 100644
--- a/testing/test_pytest_html.py
+++ b/testing/test_pytest_html.py
@@ -786,3 +786,16 @@ def test_css_invalid_no_html(self, testdir):
testdir.makepyfile("def test_pass(): pass")
result = testdir.runpytest("--css", "style.css")
assert result.ret == 0
+
+ def test_report_display_utf8(self, testdir):
+ testdir.makepyfile(
+ """
+ import pytest
+ @pytest.mark.parametrize("caseName,input,expected", [('测试用例名称', '6*6', 36)])
+ def test_eval(caseName, input, expected):
+ assert eval(input) == expected
+ """
+ )
+ result, html = run(testdir)
+ assert result.ret == 0
+ assert r'\u6d4b\u8bd5\u7528\u4f8b\u540d\u79f0' not in html