]> git.cameronkatri.com Git - cgit.git/commitdiff
Fix UTF-8 with syntax-highlighting.py
authorPřemysl Janouch <p.janouch@gmail.com>
Wed, 11 Sep 2013 18:10:12 +0000 (20:10 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 8 Jan 2014 15:49:42 +0000 (16:49 +0100)
Previously the script tried to encode output from Pygments with
the ASCII codec, which failed.

Signed-off-by: Přemysl Janouch <p.janouch@gmail.com>
filters/syntax-highlighting.py

index dcdba034f89d35caf716c9d122ab1b82f0324221..72d9097160e0bf69e853f98ad084b77322a906ec 100755 (executable)
@@ -25,6 +25,7 @@ from pygments import highlight
 from pygments.formatters import HtmlFormatter
 
 sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach())
+sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
 doc = sys.stdin.read()
 try:
        lexer = get_lexer_for_filename(sys.argv[1])