Perl Unicode Cookbook: Case- and Accent-insensitive Locale Comparisons

℞ 40: Case- and accent-insensitive locale comparisons

You now know how to compare Unicode strings while ignoring case and accent differences. This approach uses the standard Unicode collation algorithm. To perform a similar comparison while respecting a specific locale's rules, use Unicode::Collate::Locale:

 my $de = Unicode::Collate::Locale->new(
            locale => "de__phonebook",

 # now this is true:
 $de->eq("tschüß", "TSCHUESS");  # notice ü => UE, ß => SS

Previous: ℞ 39: Case- and Accent-insensitive Comparison

Series Index: The Standard Preamble

Next: ℞ 41: Unicode Linebreaking

Visit the home of the Perl programming language:

Sponsored by

Monthly Archives

Powered by Movable Type 5.13-en