summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-12-22 15:30:12 -0800
committerJunio C Hamano <gitster@pobox.com>2011-12-22 15:30:12 -0800
commit2b380d81917cb4205a0c13224086fdd9268d5b71 (patch)
tree4d6cfd4e108083330f58f1b11b9f1a994c142add
parent5d6dfc7cb140a6eb90138334fab2245b69bc8bc4 (diff)
parentb13e3eacefc0fb6f4f89738f74ba5ef14437bed5 (diff)
downloadgit-2b380d81917cb4205a0c13224086fdd9268d5b71.tar.gz
Merge branch 'jn/maint-gitweb-utf8-fix'
* jn/maint-gitweb-utf8-fix: gitweb: Fix fallback mode of to_utf8 subroutine gitweb: Output valid utf8 in git_blame_common('data') gitweb: esc_html() site name for title in OPML gitweb: Call to_utf8() on input string in chop_and_escape_str()
-rwxr-xr-xgitweb/gitweb.perl12
1 files changed, 8 insertions, 4 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f80f2594cb..fc41b07bcb 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1443,8 +1443,8 @@ sub validate_refname {
sub to_utf8 {
my $str = shift;
return undef unless defined $str;
- if (utf8::valid($str)) {
- utf8::decode($str);
+
+ if (utf8::is_utf8($str) || utf8::decode($str)) {
return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
@@ -1696,6 +1696,7 @@ sub chop_and_escape_str {
my ($str) = @_;
my $chopped = chop_str(@_);
+ $str = to_utf8($str);
if ($chopped eq $str) {
return esc_html($chopped);
} else {
@@ -6243,7 +6244,9 @@ sub git_blame_common {
-type=>"text/plain", -charset => "utf-8",
-status=> "200 OK");
local $| = 1; # output autoflush
- print while <$fd>;
+ while (my $line = <$fd>) {
+ print to_utf8($line);
+ }
close $fd
or print "ERROR $!\n";
@@ -7862,11 +7865,12 @@ sub git_opml {
-charset => 'utf-8',
-content_disposition => 'inline; filename="opml.xml"');
+ my $title = esc_html($site_name);
print <<XML;
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
<head>
- <title>$site_name OPML Export</title>
+ <title>$title OPML Export</title>
</head>
<body>
<outline text="git RSS feeds">