В Fri, 05 Nov 2010 20:51:34 -0400 David Prévot <da...@tilapin.org> пишет:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Le 05/11/2010 19:27, Sergey Alyoshin a écrit : > > On 11/6/10, David Prévot <da...@tilapin.org> wrote: > >> Le 05/11/2010 15:09, Sergey Alyoshin a écrit : > >>> Данная информация корректна? [Д/н] Д > >>> /* Дд for Yy (yes), not work: FAIL */ > >> > >> Ouch, that's annoying... Could you confirm that it actually works with > >> “y” and “Y” (it seems so after a few tests, but I would prefer a > >> second opinion). > > > > Y and y work just great. > > > Н is not ASCII char, it is Cyrillic capital "en" (UTF-8 0xd09d). > > Sure, my mistake, sorry (silly me, I should know, I just updated > koi8-r(7) :/) > > > For this test code (my second Perl code after "hello world"): > > > > my $yesexpr = langinfo(YESEXPR()); > > my $noexpr = langinfo(NOEXPR()); > > Great! > > > ж match ^[ДдYy].* # FAIL, any Cyrillic char will match? > > Definitely a problem with Perl, I guess the issue should be addressed > there, thanks for digging. With helping debian-russian@ I made a patch for adduser. I test it with UTF8 and KOI8-R encodings. Please check it with fr_FR. -- Best Regards, Yuri Kozlov
--- adduser-3.112+nmu1/adduser 2010-11-06 09:23:48.000000000 +0300 +++ /usr/sbin/adduser 2010-11-06 15:17:55.000000000 +0300 @@ -35,7 +35,7 @@ use Getopt::Long; -my $version = "VERSION"; +my $version = "3.112+nmu1"; ################### # return values @@ -66,18 +66,25 @@ } eval { require I18N::Langinfo; - import I18N::Langinfo qw(langinfo YESEXPR NOEXPR); + import I18N::Langinfo qw(langinfo CODESET YESEXPR NOEXPR); }; if ($@) { *langinfo = sub { return shift; }; *YESEXPR = sub { "^[yY]" }; *NOEXPR = sub { "^[nN]" }; + *CODESET = sub { "" }; + } + eval { + use Encode qw(decode); + }; + if ($@) { + *decode = sub { shift; return shift; }; } } setlocale(LC_MESSAGES, ""); textdomain("adduser"); -my $yesexpr = langinfo(YESEXPR()); +my $yesexpr = decode(langinfo(CODESET()), langinfo(YESEXPR())); my %config; # configuration hash @@ -531,7 +538,7 @@ create_homedir (1); # copy skeleton data # useradd without -p has left the account disabled (password string is '!') - my $yesexpr = langinfo(YESEXPR()); + my $yesexpr = decode(langinfo(CODESET()), langinfo(YESEXPR())); if ($ask_passwd) { for (;;) { my $passwd = &which('passwd'); @@ -554,6 +561,7 @@ # expression will be checked to find positive answer. print (gtx("Try again? [y/N] ")); chop ($answer=<STDIN>); + $answer = decode(langinfo(CODESET()), $answer); last if ($answer !~ m/$yesexpr/o); } else { @@ -571,7 +579,7 @@ &ch_gecos($new_gecos); } else { - my $noexpr = langinfo(NOEXPR()); + my $noexpr = decode(langinfo(CODESET()), langinfo(NOEXPR())); for (;;) { my $chfn = &which('chfn'); &systemcall($chfn, $new_name); @@ -580,6 +588,7 @@ # expression will be checked to find positive answer. print (gtx("Is the information correct? [Y/n] ")); chop (my $answer=<STDIN>); + $answer = decode(langinfo(CODESET()), $answer); last if ($answer !~ m/$noexpr/o); } }