From mboxrd@z Thu Jan 1 00:00:00 1970 From: p.janouch at gmail.com (=?UTF-8?B?UMWZZW15c2wgSmFub3VjaA==?=) Date: Fri, 13 Sep 2013 08:14:11 +0200 Subject: [PATCH 3/5] Fix UTF-8 with syntax-highlighting.py In-Reply-To: <1378923014-902-4-git-send-email-p.janouch@gmail.com> References: <1378923014-902-1-git-send-email-p.janouch@gmail.com> <1378923014-902-4-git-send-email-p.janouch@gmail.com> Message-ID: <5232AD33.7010607@gmail.com> On 11/09/13 20:10, P?emysl Janouch wrote: > Previously the script tried to encode output from Pygments with > the ASCII codec, which failed. > > Signed-off-by: P?emysl Janouch > --- > filters/syntax-highlighting.py | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/filters/syntax-highlighting.py b/filters/syntax-highlighting.py > index dcdba03..75c144a 100755 > --- a/filters/syntax-highlighting.py > +++ b/filters/syntax-highlighting.py > @@ -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.getreader("utf-8")(sys.stdout.detach()) > doc = sys.stdin.read() > try: > lexer = get_lexer_for_filename(sys.argv[1]) > Excuse me, of course it should be a writer, not a reader: -sys.stdout = codecs.getreader("utf-8")(sys.stdout.detach()) +sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) Regards, P?emysl Janouch -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 555 bytes Desc: OpenPGP digital signature URL: