in reply to Problem matching non-english chars

To expand a bit on chromatic's answer: you most likely want to use locales. From reading a bit of perllocale, it looks like the "use locale" pragma changes the way certain functions and operators think about characters (and numbers, etc.). So, for example, in your case you'd want ä to be the lower-case version of Ä.

Normally that's not the case, but if you use locales, you can force Perl to think of the characters that way. Regular expressions and case-modification functions are some of the functions modified by using locales, so you could use your case-insensitive regexp, or you could use functions like lc and uc on your strings, then do the comparison.

For example, I tried this on my local system. It's going to be different on yours, most likely, but this may give you the general idea:

use locale; use POSIX qw/locale_h/; setlocale(LC_CTYPE, "sv"); my $search_str = "gläd"; my $item_str = "GLÄD"; if ($item_str =~ /^$search_str$/i) { print "Matched!"; }
So, for me, the locale I set was "sv" (Sweden); this may differ slightly for you, as apparently the names aren't very standardized. perllocale suggests the following command lines to find the locale list:
locale -a nlsinfo ls /usr/lib/nls/loc ls /usr/lib/locale ls /usr/lib/nls
Some of these probably won't work, but hopefully, some will.

Replies are listed 'Best First'.
RE: Re: Problem matching non-english chars
by Guano (Initiate) on Apr 20, 2000 at 11:14 UTC
    Also very helpful... I haven't had the time to look in to locales yet, but your example is very close to what I had in mind. Even if the solution looks a little bit different on my system, you have all saved me a lot of headache. I'm very grateful for that!