diff options
author | Roy Marples <roy@marples.name> | 2017-03-09 00:18:10 +0000 |
---|---|---|
committer | Lukas Fleischer <lfleischer@lfos.de> | 2017-08-10 15:15:55 +0200 |
commit | 67e2b69ec96a117b98c9028013ce0258574efe80 (patch) | |
tree | b15b6f1753bdd3b941ace3ce4cd1e0cf81885807 /filters/syntax-highlighting.py | |
parent | ui-atom: properly escape delimiter in page link (diff) |
filter: set environment variable PYTHONIOENCODING to utf-8
This allows different versions of Python to be used rather than
forcing version specific encoding in each script.
Signed-off-by: Roy Marples <roy@marples.name>
Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'filters/syntax-highlighting.py')
-rwxr-xr-x | filters/syntax-highlighting.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py index 5888b50..936fdb7 100755 --- a/filters/syntax-highlighting.py +++ b/filters/syntax-highlighting.py @@ -29,9 +29,6 @@ from pygments.lexers import guess_lexer from pygments.lexers import guess_lexer_for_filename from pygments.formatters import HtmlFormatter - -sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8', errors='replace') -sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') data = sys.stdin.read() filename = sys.argv[1] formatter = HtmlFormatter(style='pastie') @@ -52,4 +49,4 @@ except TypeError: sys.stdout.write('<style>') sys.stdout.write(formatter.get_style_defs('.highlight')) sys.stdout.write('</style>') -sys.stdout.write(highlight(data, lexer, formatter, outfile=None)) +highlight(data, lexer, formatter, outfile=sys.stdout) |