case-insensitive regexp match on non-english text in perl cgi script

Posted by jonny on Stack Overflow See other posts from Stack Overflow or by jonny
Published on 2010-03-30T08:15:03Z Indexed on 2010/03/30 8:23 UTC
Read the original article Hit count: 440

Filed under:
|
|

ok. I have list of catalog paths and need to filter out some of them. Match pattern comes in non-Unicode encoding.

Tried following:

    require 5.004;
    use POSIX qw(locale_h);
    my $old_locale = setlocale(LC_ALL);
    setlocale(LC_ALL, "ru_RU.cp1251");

    @{$data -> {doc_folder_rights}} = grep {
        $_->{doc_folder} =~/$_REQUEST{q}/i; # catalog path pattern in $_REQUEST{q}
    } @{$data -> {doc_folder_rights}};

    setlocale(LC_ALL, $old_locale);

What I need is case-insensitive regexp pattern matching when pattern contains russsian letters.

© Stack Overflow or respective owner

Related posts about perl

Related posts about locale