[PATCH] D29802: opt-viewer: fix HtmlFormatter encoding
    Brian Cain via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Feb  9 17:29:10 PST 2017
    
    
  
bcain created this revision.
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.
Repository:
  rL LLVM
https://reviews.llvm.org/D29802
Files:
  utils/opt-viewer/opt-viewer.py
Index: utils/opt-viewer/opt-viewer.py
===================================================================
--- utils/opt-viewer/opt-viewer.py
+++ utils/opt-viewer/opt-viewer.py
@@ -183,7 +183,7 @@
 </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):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29802.87924.patch
Type: text/x-patch
Size: 459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170210/99eb44d8/attachment.bin>
    
    
More information about the llvm-commits
mailing list