X-Git-Url: https://git.ladys.computer/Gitweb/blobdiff_plain/6c055ceeff0cc211ae353374dd67a814575cf867b1e04ede4eb8a1693f6400d9..95e6f705b0d564e9a30ccb71cf131c92ad8cb7af373444ec23892ad17c1b2071:/gitweb.perl?ds=sidebyside diff --git a/gitweb.perl b/gitweb.perl index 0dc7e27..fb4cf84 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -1444,8 +1444,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); @@ -1697,6 +1697,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 { @@ -6244,7 +6245,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"; @@ -7863,11 +7866,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