* [PATCH] Use perl builtin class utf8 for UTF-8 decoding
@ 2007-12-05 10:26 Ismail Dönmez
2007-12-05 10:33 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Ismail Dönmez @ 2007-12-05 10:26 UTC (permalink / raw
To: Junio C Hamano; +Cc: Martin Koegler, git, Alexandre Julliard, Benjamin Close
Junio it would be very nice to get this in 1.5.4, fixes multiple problems and
tested with many distros with success.
Use perl builtin class utf8 for UTF-8 decoding, this fixes Encode problems
with older Encode and avoids problems on UTF-8 locales.
Signed-off-by: İsmail Dönmez <ismail@pardus.org.tr>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Tested-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Tested-by: Wincent Colaiuta <win@wincent.com>
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ff5daa7..db255c1 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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);
}
--
Never learn by your mistakes, if you do you may never dare to try again.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Use perl builtin class utf8 for UTF-8 decoding
2007-12-05 10:26 [PATCH] Use perl builtin class utf8 for UTF-8 decoding Ismail Dönmez
@ 2007-12-05 10:33 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-12-05 10:33 UTC (permalink / raw
To: Ismail Dönmez
Cc: Martin Koegler, git, Alexandre Julliard, Benjamin Close
Thanks. Already queued, but I've been busy and haven't pushed out yet.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-05 10:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 10:26 [PATCH] Use perl builtin class utf8 for UTF-8 decoding Ismail Dönmez
2007-12-05 10:33 ` Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).