summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test_event/formatter/xunit.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test_event/formatter/xunit.py')
-rw-r--r--packages/Python/lldbsuite/test_event/formatter/xunit.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/Python/lldbsuite/test_event/formatter/xunit.py b/packages/Python/lldbsuite/test_event/formatter/xunit.py
index 91487cd2c3a18..4c53ff8062d7d 100644
--- a/packages/Python/lldbsuite/test_event/formatter/xunit.py
+++ b/packages/Python/lldbsuite/test_event/formatter/xunit.py
@@ -84,7 +84,9 @@ class XunitFormatter(ResultsFormatter):
"""
# Get the content into unicode
if isinstance(str_or_unicode, str):
- unicode_content = str_or_unicode.decode('utf-8')
+ # If we hit decoding errors due to data corruption, replace the
+ # invalid characters with U+FFFD REPLACEMENT CHARACTER.
+ unicode_content = str_or_unicode.decode('utf-8', 'replace')
else:
unicode_content = str_or_unicode
return self.invalid_xml_re.sub(