Skip Menu |
Report information
Id: 965
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: jhi <jhi [at] iki.fi>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: (no value)
Fixed In: (no value)



Date: Mon, 5 Jul 1999 00:56:19 +0300 (EET DST)
To: Jan Starzynski <jan [...] planet.de>
Cc: perlbug [...] perl.com
Subject: Re: Bug with locale
From: Jarkko Hietaniemi <jhi [...] iki.fi>
Download (untitled) / with headers
text/plain 1.7k
Jan Starzynski writes: Show quoted text
> Hello, > > there seems to be a bug then using locales. The following script > (sorting strings case-independently) demonstrates this: > > **************************************************************** > #!/usr#!/usr/bin/perl -w > > use locale; > > $, = "\t"; > $\ = "\n"; > @list = qw(perltk perl PERLTK PERL ); > > print "original:", @list; > print "correct: ", sort NoCaseWithCopy @list; > print "wrong: ", sort NoCaseWithoutCopy @list; > > sub NoCaseWithCopy { > my $aa = lc $a; > my $bb = lc $b; > $aa cmp $bb || $a cmp $b > } > > sub NoCaseWithoutCopy { > lc($a) cmp lc($b) || $a cmp $b > } > **************************************************************** > > The output is as follows: > **************************************************************** > original: perltk perl PERLTK PERL > correct: PERL perl PERLTK perltk > wrong: PERL PERLTK perl perltk > **************************************************************** > > > When the 'use locale'-line is absent everything works fine. > > I'm using a Linux 2.0.36 machine, Perl was compiled with gcc 2.7.2.2. I > tried the Perl-Versions 5.00404, 5.000 and 5.00503 and all have this > bug. The value of $ENV{LANG} seems to have no influence on the results. > > -- > Live long and > prosper! > Your mind understands what you have been taught; Jan Starzynski > your heart, what is true. jan@planet.de > No advertising!
-- $jhi++; # http://www.iki.fi/jhi/ # There is this special biologist word we use for 'stable'. # It is 'dead'. -- Jack Cohen


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org