develooper Front page | perl.perl5.porters | Postings from July 2012

[perl #82418] sprintf() not respecting locale in 5.10+

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
July 2, 2012 23:14
Subject:
[perl #82418] sprintf() not respecting locale in 5.10+
Message ID:
rt-3.6.HEAD-28836-1341296063-864.82418-15-0@perl.org
On Mon Jul 02 22:41:20 2012, sprout wrote:
> On Mon Jul 02 20:17:15 2012, doy wrote:
> > If changes to the runtime environment can cause sprintf to need to
> > output different things, shouldn't we really just not be constant
> > folding sprintf?
> 
> I could have sworn this was already fixed (see commit b3fd6149), but it
> was only fixed for ‘use locale’, not POSIX::setlocale.

Actually, the perllocale page seems to say that setlocale is for
switching locales at run time, but ‘use locale’ is necessary for
enabling it.  It’s a bit vague, though.  This is what perl actually does:

$  ./perl -Ilib -MPOSIX -e 'setlocale(LC_ALL, "nl_NL"); print
sprintf("%f", $_=2.5)."\n";'
2,500000
$  ./perl -Ilib -MPOSIX -e 'setlocale(LC_ALL, "nl_NL"); print
sprintf("%f", 2.5)."\n";'
2.500000

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=82418

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About