[San-Diego-pm] accents

Joel Fentin joel at fentin.com
Tue Oct 26 23:02:26 CDT 2004


Douglas Wilson wrote:

> 
> 
> Joel Fentin wrote:
> 
>> I need to see if what the Spanish language operator enters is 
>> contained in a long hunk of text. Something like this:
>> if($X =~ /$Y/){[Do something]}
>>
>> The operator might enter josé, JOSÉ, or jose. He might enter niño, 
>> NIÑO, or nino.
>>
>> An i modifier to m// will take care of case. Is there any fell swoop 
>> way of taking care of accents?
> 
> 
> Those characters all have the high order bit on, so here is a crude
> way:
> my $str = "josé, JOSÉ, or jose. He might enter niño, NIÑO";
> 
> my @funny_chars = $str =~ /([^\x00-\x7F])/g;
> 
> print "@funny_chars\n";

Doug,

Although what you say is interesting, it gets me no closer to my 
solution. Knocking the high order bit from ñ does not turn it into n. 
The one is a binary 11110001 and the other is 01101110.

In order to do a language neutral look into $Y to see if $X is within, I 
will probably have to knock the accents off all such characters in both 
$X & $Y. What I am hoping is that Perl has a fell-swoop method for this.

I looked in my books, and on the Internet, but much of what I saw I 
couldn't understand (Unicode) and none of it seemed on target.
-- 
Joel Fentin    tel: 760-749-8863    FAX: 760-749-8864
Contact me:    http://fentin.com/me/ContactMe.html
Biz:           http://fentin.com
Personal:      http://fentin.com/me/



More information about the San-Diego-pm mailing list