]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Convert generated contents to utf8 in commitdiff_plain
authorYasushi SHOJI <redacted>
Tue, 29 Jan 2008 12:16:02 +0000 (21:16 +0900)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:12 +0000 (00:07 -0400)
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 <redacted>
Acked-by: İsmail Dönmez <redacted>
Acked-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index db3d749ddeeeb15f8f31f9c619e1172d6384672d96fdcd1c4e1b24ae065365f5..134b39d71f9b8ed7d662bf4284371bec9f93dcd7f49416aadc5f1d597591a081 100755 (executable)
@@ -5049,16 +5049,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";
        }
This page took 0.235179 seconds and 4 git commands to generate.