Skip to content

Commit

Permalink
opt-viewer: fix HtmlFormatter encoding
Browse files Browse the repository at this point in the history
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

llvm-svn: 294710
  • Loading branch information
anemet committed Feb 10, 2017
1 parent 0824096 commit 386cd3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/utils/opt-viewer/opt-viewer.py
Expand Up @@ -183,7 +183,7 @@ def __init__(self, source_dir, output_dir, filename):
</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):
Expand Down

0 comments on commit 386cd3d

Please sign in to comment.