[llvm] r294710 - opt-viewer: fix HtmlFormatter encoding
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 9 20:50:18 PST 2017
Author: anemet
Date: Thu Feb 9 22:50:18 2017
New Revision: 294710
URL: http://llvm.org/viewvc/llvm-project?rev=294710&view=rev
Log:
opt-viewer: fix HtmlFormatter encoding
Summary: Small fix to HtmlFormatter, defaults to ascii encoding, so utf-8 output may get `UnicodeEncodeError: 'ascii' codec can't encode character ... ordinal not in range(128)` during write.
Patch by Brian Cain!
Reviewers: anemet, fhahn
Reviewed By: anemet
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29802
Modified:
llvm/trunk/utils/opt-viewer/opt-viewer.py
Modified: llvm/trunk/utils/opt-viewer/opt-viewer.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/opt-viewer/opt-viewer.py?rev=294710&r1=294709&r2=294710&view=diff
==============================================================================
--- llvm/trunk/utils/opt-viewer/opt-viewer.py (original)
+++ llvm/trunk/utils/opt-viewer/opt-viewer.py Thu Feb 9 22:50:18 2017
@@ -183,7 +183,7 @@ class SourceFileRenderer:
</html>
'''.format(filename), file=self.stream)
- self.html_formatter = HtmlFormatter()
+ self.html_formatter = HtmlFormatter(encoding='utf-8')
self.cpp_lexer = CppLexer()
def render_source_line(self, linenum, line):
More information about the llvm-commits
mailing list