in reply to character substitution in search
If you wish to capture and use their input in that alphabet, you'll need to learn about using "locale". For example, the following fragment allows Perl to understand French characters.
You'll need to test this on your system as you may or may not have POSIX support.#!/usr/bin/perl -w use locale; use POSIX 'locale_h'; my %locale = ( French => "fr_FR.ISO_8859-1", English => "us-ascii" ); setlocale(LC_TYPE, $locale{French}) or die "Invalid locale $locale{Fre +nch}\n";
The importance of this is being able to compare strings and have the sort order what you expect. Also, it can allow you to deal with upper- and lower-casing characters correctly and handle formatted prints as you expect.
For more information, see Perl locale handling. In the "See Also" section of this link, it lists POSIX(3) sixteen times, so I suspect you want to check that, also :)
As for allowing someone to match characters without accents (resumé|resume), you may wish to check out the String::Approx module from CPAN. Be forewarned, using String::Approx is slow. If performance is a consideration, you may wish to make this function optional for the end user.
Kudos to the Perl Cookbook on this one.
|
---|