Your message dated Tue, 5 May 2009 08:32:46 +0300
with message-id <[email protected]>
and subject line Re: Bug#196106: sprintf ignores locale
has caused the Debian Bug report #196106,
regarding sprintf ignores locale
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
196106: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=196106
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: perl-base
Version: 5.6.1-8.2
Perl's sprintf ignores LC_NUMERIC and use "." (instead of "," in this case).
Both bash and libc does the right thing but not perl. This in spite of
perlfunc(1) stating "If 'use locale' is in effect, the character used for the
decimal point in formatted real numbers is affected by the LC_NUMERIC locale.
See perllocale".
$ locale
LANG=sv_SE
LC_CTYPE="sv_SE"
LC_NUMERIC="sv_SE"
LC_TIME="sv_SE"
LC_COLLATE="sv_SE"
LC_MONETARY="sv_SE"
LC_MESSAGES="sv_SE"
LC_PAPER="sv_SE"
LC_NAME="sv_SE"
LC_ADDRESS="sv_SE"
LC_TELEPHONE="sv_SE"
LC_MEASUREMENT="sv_SE"
LC_IDENTIFICATION="sv_SE"
LC_ALL=sv_SE
$ printf "%f\n" 0,123
0,123000
$ cat ltest.c
#include <stdio.h>
#include <locale.h>
main() {
setlocale(LC_ALL, "");
printf("%f\n", 0.123);
}
$ cc -o ltest ltest.c && ./ltest
0,123000
$ perl -e 'use locale; print(sprintf("%f", 0.123) . "\n" );'
0.123000
--- End Message ---
--- Begin Message ---
Version: 5.10.0-1
On Tue, Jun 10, 2003 at 07:06:32PM +1000, Brendan O'Dea wrote:
> On Wed, Jun 04, 2003 at 08:06:13PM +0200, Jon Forsberg wrote:
> >Package: perl-base
> >Version: 5.6.1-8.2
> >
> >Perl's sprintf ignores LC_NUMERIC and use "." (instead of "," in this case).
> >Both bash and libc does the right thing but not perl. This in spite of
> >perlfunc(1) stating "If 'use locale' is in effect, the character used for the
> >decimal point in formatted real numbers is affected by the LC_NUMERIC locale.
> >See perllocale".
> The documentation does appear to suggest that "use locale" should work
> as you expect--I need to dig a little deeper to determine why it
> doesn't.
>
> In the interim, try the following workaround:
>
> use locale;
> use POSIX 'locale_h';
> setlocale LC_ALL, "";
> print sprintf "%f\n", 0.123;
The documentation has been improved with perl 5.10.0, and now states:
If "use locale" is in effect, and POSIX::setlocale() has been called,
the character used for the decimal separator in formatted floating point
numbers is affected by the LC_NUMERIC locale. See perllocale and POSIX.
http://perl5.git.perl.org/perl.git/commitdiff/7e4353e96785be6
Closing accordingly.
--
Niko Tyni [email protected]
--- End Message ---