From df76f08a516b9dffbe3a228618a7a70f1393e5fc Mon Sep 17 00:00:00 2001 From: Gisle Aas Date: Sat, 21 Sep 1996 23:02:42 +0200 Subject: [PATCH] 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. --- lib/Search/Dict.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); -- 2.7.4