diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2013-09-12 03:10:12 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2014-01-09 00:49:42 (JST) |
commit | b6da53dd75a662f9a72163bc0f7052b5aa0d8d19 (patch) | |
tree | c305b65f9f50a19facac9d1f417d73ff3059ec43 /filters | |
parent | 4f6fb32f5881a093be4c2f41c72813b80404c569 (diff) | |
download | cgit-b6da53dd75a662f9a72163bc0f7052b5aa0d8d19.zip cgit-b6da53dd75a662f9a72163bc0f7052b5aa0d8d19.tar.gz |
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-x | filters/syntax-highlighting.py | 1 |
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 | |||
25 | from pygments.formatters import HtmlFormatter | 25 | from pygments.formatters import HtmlFormatter |
26 | 26 | ||
27 | sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach()) | 27 | sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach()) |
28 | sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) | ||
28 | doc = sys.stdin.read() | 29 | doc = sys.stdin.read() |
29 | try: | 30 | try: |
30 | lexer = get_lexer_for_filename(sys.argv[1]) | 31 | lexer = get_lexer_for_filename(sys.argv[1]) |