Skip to content

Commit

Permalink
Merge branch 'jn/gitweb-utf8'
Browse files Browse the repository at this point in the history
* jn/gitweb-utf8:
  gitweb: Fix handling of non-ASCII characters in inserted HTML files
  • Loading branch information
Junio C Hamano committed Dec 4, 2008
2 parents c76b4c8 + 2dcb5e1 commit ad68568
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2758,6 +2758,15 @@ sub get_file_owner {
return to_utf8($owner);
}

# assume that file exists
sub insert_file {
my $filename = shift;

open my $fd, '<', $filename;
print map(to_utf8, <$fd>);
close $fd;
}

## ......................................................................
## mimetype related functions

Expand Down Expand Up @@ -2946,9 +2955,7 @@ sub git_header_html {
"<body>\n";

if (-f $site_header) {
open (my $fd, $site_header);
print <$fd>;
close $fd;
insert_file($site_header);
}

print "<div class=\"page_header\">\n" .
Expand Down Expand Up @@ -3035,9 +3042,7 @@ sub git_footer_html {
print "</div>\n"; # class="page_footer"

if (-f $site_footer) {
open (my $fd, $site_footer);
print <$fd>;
close $fd;
insert_file($site_footer);
}

print "</body>\n" .
Expand Down Expand Up @@ -4376,9 +4381,7 @@ sub git_project_list {
git_header_html();
if (-f $home_text) {
print "<div class=\"index_include\">\n";
open (my $fd, $home_text);
print <$fd>;
close $fd;
insert_file($home_text);
print "</div>\n";
}
print $cgi->startform(-method => "get") .
Expand Down Expand Up @@ -4490,13 +4493,10 @@ sub git_summary {
print "</table>\n";

if (-s "$projectroot/$project/README.html") {
if (open my $fd, "$projectroot/$project/README.html") {
print "<div class=\"title\">readme</div>\n" .
"<div class=\"readme\">\n";
print $_ while (<$fd>);
print "\n</div>\n"; # class="readme"
close $fd;
}
print "<div class=\"title\">readme</div>\n" .
"<div class=\"readme\">\n";
insert_file("$projectroot/$project/README.html");
print "\n</div>\n"; # class="readme"
}

# we need to request one more than 16 (0..15) to check if
Expand Down

0 comments on commit ad68568

Please sign in to comment.