From: Jakub Narebski Date: Mon, 8 Dec 2008 13:13:21 +0000 (+0100) Subject: gitweb: Fix bug in insert_file() subroutine X-Git-Tag: v1.6.1-rc3~17 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4586864afee675eb1c617666f806664aef04a02a;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 951739210..6eb370d8d 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2764,7 +2764,7 @@ sub insert_file { my $filename = shift; open my $fd, '<', $filename; - print map(to_utf8, <$fd>); + print map { to_utf8($_) } <$fd>; close $fd; } diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 64c4cce58..43cd6eecb 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -673,4 +673,14 @@ test_expect_success \ gitweb_run "p=.git;a=tree"' test_debug 'cat gitweb.log' +# ---------------------------------------------------------------------- +# non-ASCII in README.html + +test_expect_success \ + 'README.html with non-ASCII characters (utf-8)' \ + 'echo "UTF-8 example:
" > .git/README.html && + cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html && + gitweb_run "p=.git;a=summary"' +test_debug 'cat gitweb.log' + test_done