summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/support/encoded_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/support/encoded_file.py')
-rw-r--r--lldb/packages/Python/lldbsuite/support/encoded_file.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/support/encoded_file.py b/lldb/packages/Python/lldbsuite/support/encoded_file.py
index 1b4c7a2e48d..c233e046ba7 100644
--- a/lldb/packages/Python/lldbsuite/support/encoded_file.py
+++ b/lldb/packages/Python/lldbsuite/support/encoded_file.py
@@ -31,6 +31,9 @@ def _encoded_write(old_write, encoding):
# as unicode before attempting to write.
if isinstance(s, six.binary_type):
s = s.decode(encoding, "replace")
+ # Filter unreadable characters, Python 3 is stricter than python 2 about them.
+ import re
+ s = re.sub(r'[^\x00-\x7f]',r' ',s)
return old_write(s)
return impl
OpenPOWER on IntegriCloud