I am assuming that if your users are going to use your work, they probably have native keyboards (I've tried learning the French one and I can attest that they are a pain). This allows them to type in the alphabet of their choice.

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.

#!/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";
You'll need to test this on your system as you may or may not have POSIX support.

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.


In reply to Re: character substitution in search by Ovid
in thread character substitution in search by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.