gitweb: Convert generated contents to utf8 in commitdiff_plain
If the commit message, or commit author contains non-ascii, it must be converted from Perl internal representation to utf-8, to follow what got declared in HTTP header. Use to_utf8() to do the conversion. This necessarily replaces here-doc with "print" statements. Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com> Acked-by: İsmail Dönmez <ismail@pardus.org.tr> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Yasushi SHOJI committed
Jan 29, 2008 at 21:16 UTC
7720224cebde08186627ab7bdb06018905d84e30
1 file changed
+5
-6
gitweb/gitweb.perl
+5
-6
@@ -5048,16 +5048,15 @@ sub git_commitdiff {
5048
-expires => $expires,
5049
-content_disposition => 'inline; filename="' . "$filename" . '"');
5050
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
5051
- print <<TEXT;
5052
-From: $co{'author'}
5053
-Date: $ad{'rfc2822'} ($ad{'tz_local'})
5054
-Subject: $co{'title'}
5055
-TEXT
5051
+ print "From: " . to_utf8($co{'author'}) . "\n";
5052
+ print "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n";
5053
+ print "Subject: " . to_utf8($co{'title'}) . "\n";
5054
+
5055
print "X-Git-Tag: $tagname\n" if $tagname;
5056
print "X-Git-Url: " . $cgi->self_url() . "\n\n";
5057
5058
foreach my $line (@{$co{'comment'}}) {
5060
- print "$line\n";
5059
+ print to_utf8($line) . "\n";
5060
}
5061
print "---\n\n";
5062
}