Browse Source

gitweb: use Perl built-in utf8 function for UTF-8 decoding.

Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>
Tested-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
İsmail Dönmez 17 years ago committed by Junio C Hamano
parent
commit
e5d3de5c45
  1. 7
      gitweb/gitweb.perl

7
gitweb/gitweb.perl

@ -695,10 +695,9 @@ sub validate_refname {
# in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning # in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
sub to_utf8 { sub to_utf8 {
my $str = shift; my $str = shift;
my $res; if (utf8::valid($str)) {
eval { $res = decode_utf8($str, Encode::FB_CROAK); }; utf8::decode($str);
if (defined $res) { return $str;
return $res;
} else { } else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT); return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
} }

Loading…
Cancel
Save