diff options
author | lookshe <github@lookshe.org> | 2016-02-08 14:03:18 +0100 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2016-02-08 14:03:18 +0100 |
commit | 70d357f2397f70434f9c0246fe963b5795e2583f (patch) | |
tree | 626afab9733e8eb20d23d3f93269739f962683f3 /filters | |
parent | a4d069bbd96810a7e3efc0d32c2889c83b9747e3 (diff) |
reverted changes to run under python 2.6
Diffstat (limited to 'filters')
-rwxr-xr-x | filters/syntax-highlighting.py | 6 |
1 files changed, 2 insertions, 4 deletions
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') |