[знатокам perl] русский в регулярных выражениях (bug#486877)
Здравствуйте.
Ошибка #486877 в adduser наблюдается и для русского языка.
Знатоки perl, подскажите как нужно правильно написать тестовую программку
(или может сразу исправите багу?),
чтобы она правильно отрабатывала (взято из debian-l10-russian@).
use utf8;
require POSIX;
import POSIX qw(setlocale);
require I18N::Langinfo;
import I18N::Langinfo qw(langinfo YESEXPR NOEXPR);
setlocale(LC_ALL, "");
my $yesexpr = langinfo(YESEXPR());
my $noexpr = langinfo(NOEXPR());
foreach my $c ('y', 'Y', 'n', 'N', 'д', 'Д', 'н', 'Н', 'ж') {
if ($c =~ m/$yesexpr/o) {print "$c match $yesexpr\n";}
if ($c !~ m/$yesexpr/o) {print "$c not match $yesexpr\n";}
if ($c =~ m/$noexpr/o) {print "$c match $noexpr\n";}
if ($c !~ m/$noexpr/o) {print "$c not match $noexpr\n";}
}
результат:
y match ^[ДдYy].*
y not match ^[НнNn].*
Y match ^[ДдYy].*
Y not match ^[НнNn].*
n not match ^[ДдYy].*
n match ^[НнNn].*
N not match ^[ДдYy].*
N match ^[НнNn].*
Wide character in print at t.perl line 14.
д not match ^[ÐдYy].*
Wide character in print at t.perl line 16.
д not match ^[ÐнNn].*
Wide character in print at t.perl line 14.
Д not match ^[ÐдYy].*
Wide character in print at t.perl line 16.
Д not match ^[ÐнNn].*
Wide character in print at t.perl line 14.
н not match ^[ÐдYy].*
Wide character in print at t.perl line 16.
н not match ^[ÐнNn].*
Wide character in print at t.perl line 14.
Н not match ^[ÐдYy].*
Wide character in print at t.perl line 16.
Н not match ^[ÐнNn].*
Wide character in print at t.perl line 14.
ж not match ^[ÐдYy].*
Wide character in print at t.perl line 16.
ж not match ^[ÐнNn].*
--
Best Regards,
Yuri Kozlov
Reply to: