Code

gitweb: Fix fallback mode of to_utf8 subroutine
[git.git] / gitweb / gitweb.perl
index dc2ad9d4a4d9c56c78cb73a31492bf93be93141f..874023a33e9162b99bfa5b0e4038b102c129f6f1 100755 (executable)
@@ -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);