diff options
Diffstat (limited to '')
-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') |