{"thread":{"id":"11140","subject":"[PATCH] Use perl builtin class utf8 for UTF-8 decoding","startedAt":"2007-12-05T10:26:30Z","lastAt":"2007-12-05T10:33:13Z","messageCount":2,"participants":["Ismail Dönmez","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"61993","messageId":"200712051226.30162.ismail@pardus.org.tr","threadId":"11140","inReplyTo":null,"subject":"[PATCH] Use perl builtin class utf8 for UTF-8 decoding","fromName":"Ismail Dönmez","fromEmail":"ismail@pardus.org.tr","sentAt":"2007-12-05T10:26:30Z","receivedAt":"2007-12-05T10:26:30Z","isPatch":true,"sender":{"key":"ismail@pardus.org.tr","avatar":null},"body":"Junio it would be very nice to get this in 1.5.4, fixes multiple problems and \ntested with many distros with success.\n\nUse perl builtin class utf8 for UTF-8 decoding, this fixes Encode problems \nwith older Encode and avoids problems on UTF-8 locales.\n\nSigned-off-by: İsmail Dönmez <ismail@pardus.org.tr>\nAcked-by: Jakub Narebski <jnareb@gmail.com>\nTested-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>\nTested-by: Wincent Colaiuta <win@wincent.com>\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ff5daa7..db255c1 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -695,10 +695,9 @@ sub validate_refname {\n # in utf-8 thanks to \"binmode STDOUT, ':utf8'\" at beginning\n sub to_utf8 {\n \tmy $str = shift;\n-\tmy $res;\n-\teval { $res = decode_utf8($str, Encode::FB_CROAK); };\n-\tif (defined $res) {\n-\t\treturn $res;\n+        if (utf8::valid($str)) {\n+                utf8::decode($str);\n+                return $str;\n \t} else {\n \t\treturn decode($fallback_encoding, $str, Encode::FB_DEFAULT);\n \t}\n\n\n-- \nNever learn by your mistakes, if you do you may never dare to try again.\n"},{"id":"61995","messageId":"7vzlwpv3bq.fsf@gitster.siamese.dyndns.org","threadId":"11140","inReplyTo":"200712051226.30162.ismail@pardus.org.tr","subject":"Re: [PATCH] Use perl builtin class utf8 for UTF-8 decoding","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-05T10:33:13Z","receivedAt":"2007-12-05T10:33:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.  Already queued, but I've been busy and haven't pushed out yet.\n"}]}