neocgit

a more 'modern' version of cgit
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/neocgit

commit d3756bd7b00f9ad6adede3c7f956a25b22a2254a
parent 33bc949a1e927e14479568518bd92e70998e25f8
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Mon, 18 Jan 2016 11:14:06 +0100

syntax-highlighting: always use utf-8 to avoid ascii codec issues

Diffstat:
Mfilters/syntax-highlighting.py | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py @@ -21,6 +21,7 @@ import sys +import io from pygments import highlight from pygments.util import ClassNotFound from pygments.lexers import TextLexer @@ -29,6 +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') data = sys.stdin.read() filename = sys.argv[1] formatter = HtmlFormatter(style='pastie')