From 70d357f2397f70434f9c0246fe963b5795e2583f Mon Sep 17 00:00:00 2001 From: lookshe Date: Mon, 8 Feb 2016 14:03:18 +0100 Subject: reverted changes to run under python 2.6 --- filters/syntax-highlighting.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'filters') diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py index ec970ab..bcf32c8 100755 --- a/filters/syntax-highlighting.py +++ b/filters/syntax-highlighting.py @@ -21,7 +21,6 @@ import sys -import io from pygments import highlight from pygments.util import ClassNotFound from pygments.lexers import TextLexer @@ -30,9 +29,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() +# read stdin and decode to utf-8. ignore any unkown signs. +data = sys.stdin.read().decode(encoding='utf-8', errors='ignore') filename = sys.argv[1] formatter = HtmlFormatter(encoding='utf-8', style='pastie') -- cgit v1.2.3