]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Fix fallback mode of to_utf8 subroutine
[Gitweb] / gitweb.perl
index 67b41e584f3120409e2cae97849549cf95caaa95c8d7dae3bf675aed05364389..fb4cf84d591c40e9071c26ca7d1b0262bec5802088a2bedbf97eaff60701952a 100755 (executable)
@@ -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);
@@ -6245,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";
 
This page took 0.337845 seconds and 4 git commands to generate.