D
damjensen
I have some questions about Locales on Win32 (Perl 5.10.0, Activeperl)
I needed to process Excel sheets with numbers, formattet with comma as
decimal point.
In my programming I found this peculiar difference:
Danish POSIX local, which fails (drops decimal value):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "da" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
GERMAN version which works (discovered by mistake):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "ge" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
This leads me to my questions:
1) where is the use of Locale and Win32 documented ? The perllocale
mentions NOTHING of Win32, and their examples using setlocale(.. )
fails.
2) why are languages on Win32 different, and where is this
documented ? Maybe an MS thing...
3) can I import a module to make locales work as Unix, on Win32
systems.
4) can I change Danish setting to make it work with decimal numbers.
Hope some expert in Locales can help me.
I needed to process Excel sheets with numbers, formattet with comma as
decimal point.
In my programming I found this peculiar difference:
Danish POSIX local, which fails (drops decimal value):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "da" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
GERMAN version which works (discovered by mistake):
use strict;
use locale;
use POSIX;
POSIX::setlocale( &POSIX::LC_ALL, "ge" );
my $number1 = "-123,44";
my $number2 = 10;
my $result = $number1 / $number2;
printf ('%4.4f', $result);
printf ('%4.4f', $number1 * -1);
This leads me to my questions:
1) where is the use of Locale and Win32 documented ? The perllocale
mentions NOTHING of Win32, and their examples using setlocale(.. )
fails.
2) why are languages on Win32 different, and where is this
documented ? Maybe an MS thing...
3) can I import a module to make locales work as Unix, on Win32
systems.
4) can I change Danish setting to make it work with decimal numbers.
Hope some expert in Locales can help me.