perl-unicode

Re: Caseless and accentless string comparisons

2003-05-12 11:30:04
Ah!  I think I've got it.

Is this the recommended way to do comparisons:
--
my $col = Unicode::Collate->new(level => 1);  # Caseless and accentless
...
if ($col->cmp($s1, $s2) == 0) {
    # We have a match
    ...
}
--

Or will this break in locales that have different meanings for the
different levels?  (Is there a reference for what the different levels
mean in different locales?)

BTW the update to UTS is pretty cool, addressing some major
shortcomings of the current version (but totally frightening).

One last question, how come allkeys.txt is not distributed with the
Unicode::Collate module (or in a separate wrapper module).  The way it
works now is kind of annoying since there is no good way to write a
build dependency on it.  It would be cool if a recent release were in
the module and if you have the appropriate modules it could get the
most current version off the website at install time (after asking).

                    -ben