[PATCH] D49379: lldbsuite: ignore decoding errors in _encoded_write
Konstantin Baladurin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 17 06:03:33 PDT 2018
kbaladurin updated this revision to Diff 155826.
kbaladurin added a comment.
Thank you for comments, I've updated patch. I agree that it is not complete solution, maybe better to make all tests unicode safe.
https://reviews.llvm.org/D49379
Files:
packages/Python/lldbsuite/support/encoded_file.py
Index: packages/Python/lldbsuite/support/encoded_file.py
===================================================================
--- packages/Python/lldbsuite/support/encoded_file.py
+++ packages/Python/lldbsuite/support/encoded_file.py
@@ -31,7 +31,9 @@
# If we were asked to write a `str` (in Py2) or a `bytes` (in Py3) decode it
# as unicode before attempting to write.
if isinstance(s, six.binary_type):
- s = s.decode(encoding)
+ # When decoding the string, replace invalid characters with (U+FFFD, 'REPLACEMENT CHARACTER').
+ # This may result in data loss
+ s = s.decode(encoding, 'replace')
return old_write(s)
return impl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49379.155826.patch
Type: text/x-patch
Size: 714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180717/2eabee85/attachment.bin>
More information about the llvm-commits
mailing list