List for cgit developers and users
 help / color / mirror / Atom feed
Subject: [PATCH 3/5] Fix UTF-8 with syntax-highlighting.py
Date: Fri, 13 Sep 2013 08:14:11 +0200	[thread overview]
Message-ID: <5232AD33.7010607@gmail.com> (raw)
In-Reply-To: <1378923014-902-4-git-send-email-p.janouch@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 <p.janouch at gmail.com>
> ---
>  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: <http://lists.zx2c4.com/pipermail/cgit/attachments/20130913/8533cf36/attachment.asc>


  reply	other threads:[~2013-09-13  6:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11 18:10 [PATCH 0/5] Miscellaneous fixes 
2013-09-11 18:10 ` [PATCH 1/5] Fix some spelling errors 
2014-01-08 15:46   ` Jason
2013-09-11 18:10 ` [PATCH 2/5] Fix about-formatting.sh 
2014-01-08 15:47   ` Jason
2013-09-11 18:10 ` [PATCH 3/5] Fix UTF-8 with syntax-highlighting.py 
2013-09-13  6:14   `  [this message]
2014-01-08 15:49     ` Jason
2013-09-11 18:10 ` [PATCH 4/5] Fix the example configuration 
2014-01-08 15:47   ` Jason
2013-09-11 18:10 ` [PATCH 5/5] Add a suggestion to the manpage 
2014-01-08 15:48   ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5232AD33.7010607@gmail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).