From: Gisle Aas Date: Sat, 21 Sep 1996 21:02:42 +0000 (+0200) Subject: look() in Search::Dict should use lc() istead of tr/A-Z/a-z/ X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df76f08a516b9dffbe3a228618a7a70f1393e5fc;p=p5sagit%2Fp5-mst-13.2.git look() in Search::Dict should use lc() istead of tr/A-Z/a-z/ The Search::Dict look() function should use the lc() function instead of tr/A-Z/a-z/. This will make folding of non-english letters work if the locale is set up correctly. --- diff --git a/lib/Search/Dict.pm b/lib/Search/Dict.pm index 295da6b..1cd5cf8 100644 --- a/lib/Search/Dict.pm +++ b/lib/Search/Dict.pm @@ -37,7 +37,7 @@ sub look { my($size, $blksize) = @stat[7,11]; $blksize ||= 8192; $key =~ s/[^\w\s]//g if $dict; - $key =~ tr/A-Z/a-z/ if $fold; + $key = lc $key if $fold; my($min, $max, $mid) = (0, int($size / $blksize)); while ($max - $min > 1) { $mid = int(($max + $min) / 2); @@ -47,7 +47,7 @@ sub look { $_ = ; chop; s/[^\w\s]//g if $dict; - tr/A-Z/a-z/ if $fold; + $_ = lc $_ if $fold; if (defined($_) && $_ lt $key) { $min = $mid; } @@ -65,7 +65,7 @@ sub look { or last; chop; s/[^\w\s]//g if $dict; - y/A-Z/a-z/ if $fold; + $_ = lc $_ if $fold; last if $_ ge $key; } seek(FH,$min,0);