diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index dc2ad9d4a4d9c56c78cb73a31492bf93be93141f..874023a33e9162b99bfa5b0e4038b102c129f6f1 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
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);