From cc41da1dc458cea98a0abe7e31491527bc1a4c72 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 16 Apr 2011 11:22:44 +0200 Subject: [PATCH] html report: better handling of non ASCII characters in C source code --- htmlreport/cppcheck-htmlreport | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htmlreport/cppcheck-htmlreport b/htmlreport/cppcheck-htmlreport index 018da86d3..1afa1ec0e 100755 --- a/htmlreport/cppcheck-htmlreport +++ b/htmlreport/cppcheck-htmlreport @@ -269,7 +269,10 @@ if __name__ == '__main__': htmlFormatter.errors = errors stream = file(os.path.join(options.report_dir, htmlfile), "w") stream.write(HTML_HEAD % (options.title, htmlFormatter.get_style_defs(".highlight"), options.title)) - stream.write(highlight(content, guess_lexer_for_filename(source_file, ""), htmlFormatter)) + lexer = guess_lexer_for_filename(source_file, "") + if options.source_encoding: + lexer.encoding = options.source_encoding + stream.write(highlight(content, lexer, htmlFormatter)) stream.write(HTML_FOOTER) stream.close()