Skip to content

Commit 7720224

Browse files
yashigitster
authored andcommitted
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>
1 parent ab989ad commit 7720224

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

gitweb/gitweb.perl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5048,16 +5048,15 @@ sub git_commitdiff {
50485048
-expires => $expires,
50495049
-content_disposition => 'inline; filename="' . "$filename" . '"');
50505050
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+
50565055
print "X-Git-Tag: $tagname\n" if $tagname;
50575056
print "X-Git-Url: " . $cgi->self_url() . "\n\n";
50585057

50595058
foreach my $line (@{$co{'comment'}}) {
5060-
print "$line\n";
5059+
print to_utf8($line) . "\n";
50615060
}
50625061
print "---\n\n";
50635062
}

0 commit comments

Comments
 (0)