Index: tools/opt-viewer/opt-viewer.py =================================================================== --- tools/opt-viewer/opt-viewer.py +++ tools/opt-viewer/opt-viewer.py @@ -10,6 +10,7 @@ import os.path import re import shutil +import sys from pygments import highlight from pygments.lexers.c_cpp import CppLexer @@ -62,7 +63,10 @@ html_highlighted = highlight( file_text, self.cpp_lexer, - self.html_formatter).decode('utf-8') + self.html_formatter) + + if sys.version_info >= (3, 0): + html_highlighted = html_highlighted.decode('utf-8') # Take off the header and footer, these must be # reapplied line-wise, within the page structure