summaryrefslogtreecommitdiff
path: root/filters/syntax-highlighting.py
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-01-22 11:44:44 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2017-01-22 11:44:44 +0000
commit5564a5d06678b3f9b0725bc4b2383ea1b7eb5515 (patch)
tree6a316698ab978214f69dc1a948929efaa88634fa /filters/syntax-highlighting.py
parent91153fd02e62f2eaca8e6c140baa4f2abf39c40e (diff)
downloadcgit-5564a5d06678b3f9b0725bc4b2383ea1b7eb5515.tar
cgit-5564a5d06678b3f9b0725bc4b2383ea1b7eb5515.tar.gz
cgit-5564a5d06678b3f9b0725bc4b2383ea1b7eb5515.zip
syntax-highlighting: replace invalid unicode with ?
Diffstat (limited to 'filters/syntax-highlighting.py')
-rwxr-xr-xfilters/syntax-highlighting.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py
index 1ca4108..5888b50 100755
--- a/filters/syntax-highlighting.py
+++ b/filters/syntax-highlighting.py
@@ -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')