augusto2112 created this revision.
augusto2112 added reviewers: mib, JDevlieghere, jingham.
Herald added a project: All.
augusto2112 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
The python "open" function will use the default encoding for the
locale (the result of "locale.getpreferredencoding()"). Explicitly set
the locale to utf-8 when opening the crashlog for writing, as there may
be non-ascii symbols in there (for example, Swift uses "τ" to indicate
generic parameters).
rdar://101402755
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136798
Files:
lldb/examples/python/crashlog.py
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -865,7 +865,7 @@
result.PutCString(
"error: invalid arguments, a single output file is the only valid
argument")
return
- out_file = open(args[0], 'w')
+ out_file = open(args[0], 'w', encoding='utf-8')
if not out_file:
result.PutCString(
"error: failed to open file '%s' for writing...",
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -865,7 +865,7 @@
result.PutCString(
"error: invalid arguments, a single output file is the only valid argument")
return
- out_file = open(args[0], 'w')
+ out_file = open(args[0], 'w', encoding='utf-8')
if not out_file:
result.PutCString(
"error: failed to open file '%s' for writing...",
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits