Skip to content

Commit

Permalink
gitweb: use Perl built-in utf8 function for UTF-8 decoding.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
İsmail Dönmez authored and Junio C Hamano committed Dec 4, 2007
1 parent dcbcb70 commit e5d3de5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,9 @@ sub validate_refname {
# in utf-8 thanks to "binmode STDOUT, ':utf8'" at beginning
sub to_utf8 {
my $str = shift;
my $res;
eval { $res = decode_utf8($str, Encode::FB_CROAK); };
if (defined $res) {
return $res;
if (utf8::valid($str)) {
utf8::decode($str);
return $str;
} else {
return decode($fallback_encoding, $str, Encode::FB_DEFAULT);
}
Expand Down

0 comments on commit e5d3de5

Please sign in to comment.