about summary refs log tree commit diff stats
path: root/filters
diff options
context:
space:
mode:
authorPřemysl Janouch2013-09-11 20:10:12 +0200
committerJason A. Donenfeld2014-01-08 16:49:42 +0100
commitb6da53dd75a662f9a72163bc0f7052b5aa0d8d19 (patch)
treec305b65f9f50a19facac9d1f417d73ff3059ec43 /filters
parentAdd a suggestion to the manpage (diff)
downloadcgit-b6da53dd75a662f9a72163bc0f7052b5aa0d8d19.tar.gz
cgit-b6da53dd75a662f9a72163bc0f7052b5aa0d8d19.zip
Fix UTF-8 with syntax-highlighting.py
Previously the script tried to encode output from Pygments with
the ASCII codec, which failed.

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/syntax-highlighting.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py index dcdba03..72d9097 100755 --- a/filters/syntax-highlighting.py +++ b/filters/syntax-highlighting.py
@@ -25,6 +25,7 @@ from pygments import highlight
25from pygments.formatters import HtmlFormatter 25from pygments.formatters import HtmlFormatter
26 26
27sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach()) 27sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
28sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
28doc = sys.stdin.read() 29doc = sys.stdin.read()
29try: 30try:
30 lexer = get_lexer_for_filename(sys.argv[1]) 31 lexer = get_lexer_for_filename(sys.argv[1])