gitweb: Fix bug in insert_file() subroutine
In insert_file() subroutine (which is used to insert HTML fragments as custom header, footer, hometext (for projects list view), and per project README.html (for summary view)) we used: map(to_utf8, <$fd>); This doesn't work, and other form has to be used: map { to_utf8($_) } <$fd>; Now with test for t9600 added, for $GIT_DIR/README.html. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
Dec 8, 2008 at 14:13 UTC
4586864afee675eb1c617666f806664aef04a02a
2 files changed
+11
-1
gitweb/gitweb.perl
+1
-1
@@ -2764,7 +2764,7 @@ sub insert_file {
2764
my $filename = shift;
2765
2766
open my $fd, '<', $filename;
2767
- print map(to_utf8, <$fd>);
2767
+ print map { to_utf8($_) } <$fd>;
2768
close $fd;
2769
}
2770
t/t9500-gitweb-standalone-no-errors.sh
+10
@@ -673,4 +673,14 @@ test_expect_success \
673
gitweb_run "p=.git;a=tree"'
674
test_debug 'cat gitweb.log'
675
676
+# ----------------------------------------------------------------------
677
+# non-ASCII in README.html
678
+
679
+test_expect_success \
680
+ 'README.html with non-ASCII characters (utf-8)' \
681
+ 'echo "<b>UTF-8 example:</b><br />" > .git/README.html &&
682
+ cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html &&
683
+ gitweb_run "p=.git;a=summary"'
684
+test_debug 'cat gitweb.log'
685
+
686
test_done