]> git.cameronkatri.com Git - cgit.git/commitdiff
syntax-highlighting: replace invalid unicode with ?
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 22 Jan 2017 11:44:44 +0000 (12:44 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 22 Jan 2017 11:44:44 +0000 (12:44 +0100)
filters/syntax-highlighting.py

index 1ca410815a85a980b927f3d412c280937d1ade6e..5888b507863f020dddf7f5f7606c6bfcb304869e 100755 (executable)
@@ -30,8 +30,8 @@ from pygments.lexers import guess_lexer_for_filename
 from pygments.formatters import HtmlFormatter
 
 
-sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
-sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
+sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace')
+sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
 data = sys.stdin.read()
 filename = sys.argv[1]
 formatter = HtmlFormatter(style='pastie')