git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Jürgen Kreileder" <jk@blackdown.de>
Cc: git@vger.kernel.org, Jakub Narebski <jnareb@gmail.com>
Subject: Re: [PATCH] gitweb: Output valid utf8 in git_blame_common('data')
Date: Tue, 29 Nov 2011 11:46:56 -0800 (PST)	[thread overview]
Message-ID: <m3d3calnip.fsf@localhost.localdomain> (raw)
In-Reply-To: <CAKD0Uuxq+wLdRy5r_hz9qgjHkDmFHHbeAVkb07HizX9xaGMptw@mail.gmail.com>

Jürgen Kreileder <jk@blackdown.de> writes:

> With javascript-actions enabled gitweb showed broken author names in
> the tooltips on blame pages.
> 
> Signed-off-by: Juergen Kreileder <jk@blackdown.de>
> ---
>  gitweb/gitweb.perl |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 4f0c3bd..c863afe 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -6107,7 +6107,9 @@ sub git_blame_common {
>  			-type=>"text/plain", -charset => "utf-8",
>  			-status=> "200 OK");
>  		local $| = 1; # output autoflush
> -		print while <$fd>;
> +		while (my $line = <$fd>) {
> +			print to_utf8($line);
> +		}
>  		close $fd
>  			or print "ERROR $!\n";
> 
> -- 

Thanks.  ACK.


BTW. all those troubles with not forgetting to call to_utf8() make me
wonder if we wouldn't be better to forget about supporting
$fallback_encoding and just put

  use open qw(:encoding(UTF-8) :std); 

at the beginning of gitweb, c.f. http://training.perl.com/OSCON2011/index.html


Or

  use open qw(:utf8 :std); 

though then we simply discard errors.

-- 
Jakub Narębski

      reply	other threads:[~2011-11-29 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-27 23:52 [PATCH] gitweb: Output valid utf8 in git_blame_common('data') Jürgen Kreileder
2011-11-29 19:46 ` Jakub Narebski [this message]

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=m3d3calnip.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jk@blackdown.de \
    /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).