X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gitweb%2Fgitweb.perl;h=874023a33e9162b99bfa5b0e4038b102c129f6f1;hb=b13e3eacefc0fb6f4f89738f74ba5ef14437bed5;hp=4f0c3bd90c7f90dad1674f50999da534c33c0261;hpb=92622e62145b05a159b057a4334205e6a3b07630;p=git.git diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4f0c3bd90..874023a33 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1442,8 +1442,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); @@ -1695,6 +1695,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 { @@ -6107,7 +6108,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"; @@ -7699,11 +7702,12 @@ sub git_opml { -charset => 'utf-8', -content_disposition => 'inline; filename="opml.xml"'); + my $title = esc_html($site_name); print < - $site_name OPML Export + $title OPML Export