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>
This commit is contained in:
parent
ab989adf6a
commit
7720224ceb
@ -5048,16 +5048,15 @@ sub git_commitdiff {
|
||||
-expires => $expires,
|
||||
-content_disposition => 'inline; filename="' . "$filename" . '"');
|
||||
my %ad = parse_date($co{'author_epoch'}, $co{'author_tz'});
|
||||
print <<TEXT;
|
||||
From: $co{'author'}
|
||||
Date: $ad{'rfc2822'} ($ad{'tz_local'})
|
||||
Subject: $co{'title'}
|
||||
TEXT
|
||||
print "From: " . to_utf8($co{'author'}) . "\n";
|
||||
print "Date: $ad{'rfc2822'} ($ad{'tz_local'})\n";
|
||||
print "Subject: " . to_utf8($co{'title'}) . "\n";
|
||||
|
||||
print "X-Git-Tag: $tagname\n" if $tagname;
|
||||
print "X-Git-Url: " . $cgi->self_url() . "\n\n";
|
||||
|
||||
foreach my $line (@{$co{'comment'}}) {
|
||||
print "$line\n";
|
||||
print to_utf8($line) . "\n";
|
||||
}
|
||||
print "---\n\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user