summaryrefslogtreecommitdiff
path: root/development/cgit/patches/0004-syntax-highlighting-replace-invalid-unicode-with.patch
blob: 47483837f484af07680f9c5f53d8f7af80e2b40f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
From 5564a5d06678b3f9b0725bc4b2383ea1b7eb5515 Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Sun, 22 Jan 2017 12:44:44 +0100
Subject: [PATCH 04/15] syntax-highlighting: replace invalid unicode with ?

---
 filters/syntax-highlighting.py | 4 ++--
 1 file 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')
-- 
2.14.1