]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: use Perl built-in utf8 function for UTF-8 decoding.
authorİsmail Dönmez <redacted>
Tue, 4 Dec 2007 08:55:41 +0000 (10:55 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:12 +0000 (00:07 -0400)
Signed-off-by: İsmail Dönmez <redacted>
Tested-by: Martin Koegler <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 68795d0360e26a70630fae9126016336b456c03ed60face1c484044bee46ba01..ec6d5f904a48bdc929bf2117d318199786db4d02631becb1fe2d3a5cd7e85ce0 100755 (executable)
@@ -696,10 +696,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);
        }
This page took 0.271403 seconds and 4 git commands to generate.