On 5 Jun 2005, at 01:36, John Peacock wrote:
I concur that this is probably something weird with the Apple implementation. I have a small script in my Math::Currency distro which extracts the currency information for different locales and this is what I see with SUSE 9.2's eu_ES:

$LC_MONETARY->{EUR} = {
        INT_CURR_SYMBOL =>      'EUR ',
        CURRENCY_SYMBOL =>      'EUR',
        MON_DECIMAL_POINT       =>      ',',
        MON_THOUSANDS_SEP       =>      '.',
        MON_GROUPING    =>      '3',
        POSITIVE_SIGN   =>      '',
        NEGATIVE_SIGN   =>      '-',
        INT_FRAC_DIGITS =>      '2',
        FRAC_DIGITS     =>      '2',
        P_CS_PRECEDES   =>      '1',
        P_SEP_BY_SPACE  =>      '1',
        N_CS_PRECEDES   =>      '1',
        N_SEP_BY_SPACE  =>      '1',
        P_SIGN_POSN     =>      '1',
        N_SIGN_POSN     =>      '1',
};

(even the utf8 variant shows the same values for MON_DECIMAL_POINT and MON_THOUSANDS_SEP). If you are interested in confirming, download the Math::Currency distro from CPAN and run the scripts/ new_currency under Darwin (you'll have to delete the existing lib/ Math/Currency/EUR.pm) and report back what it finds.

Agreed it's Apple's bug. Here's my trivial test script, followed by some output (from Apple's default perl, which for Tiger, is 5.8.6):

$ cat localetest.pl
use POSIX qw(setlocale localeconv);
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;    # Present hash keys in sorted order
printf "Locale = %s\n", POSIX::setlocale( &POSIX::LC_ALL, shift || 'C');
print Dumper POSIX::localeconv();
$ for l in '' en_GB es_ES eu_ES; do /usr/bin/perl localetest.pl $l; done
Locale = C
$VAR1 = {
          'decimal_point' => '.',
          'grouping' => '',
          'mon_grouping' => ''
        };
Locale = en_GB
$VAR1 = {
          'currency_symbol' => '£',
          'decimal_point' => '.',
          'frac_digits' => 2,
          'grouping' => '',
          'int_curr_symbol' => 'GBP ',
          'int_frac_digits' => 2,
          'mon_decimal_point' => '.',
          'mon_grouping' => '',
          'mon_thousands_sep' => ',',
          'n_cs_precedes' => 1,
          'n_sep_by_space' => 0,
          'n_sign_posn' => 1,
          'negative_sign' => '-',
          'p_cs_precedes' => 1,
          'p_sep_by_space' => 0,
          'p_sign_posn' => 1,
          'thousands_sep' => ','
        };
Locale = es_ES
$VAR1 = {
          'currency_symbol' => 'Eu',
          'decimal_point' => ',',
          'frac_digits' => 2,
          'grouping' => '',
          'int_curr_symbol' => 'EUR ',
          'int_frac_digits' => 2,
          'mon_decimal_point' => ',',
          'mon_grouping' => '',
          'mon_thousands_sep' => '.',
          'n_cs_precedes' => 1,
          'n_sep_by_space' => 1,
          'n_sign_posn' => 1,
          'negative_sign' => '-',
          'p_cs_precedes' => 1,
          'p_sep_by_space' => 1,
          'p_sign_posn' => 1
        };
Locale = eu_ES
$VAR1 = {
          'currency_symbol' => 'Eu',
          'decimal_point' => '\' ',
          'frac_digits' => 2,
          'grouping' => '',
          'int_curr_symbol' => 'EUR ',
          'int_frac_digits' => 2,
          'mon_decimal_point' => ',',
          'mon_grouping' => '',
          'mon_thousands_sep' => '.',
          'n_cs_precedes' => 1,
          'n_sep_by_space' => 1,
          'n_sign_posn' => 1,
          'negative_sign' => '-',
          'p_cs_precedes' => 1,
          'p_sep_by_space' => 1,
          'p_sign_posn' => 1,
          'thousands_sep' => '.'
        };

Notice the really silly decimal_point for the eu_ES locale. (I'm also vaguely surprised that none of the locales I've tried has a grouping or mon_grouping defined.) I've posted this as a bug to Apple (Bug ID# 4139653).

On 4 Jun 2005, at 20:40, Paul Schinder wrote:

The question is, should perl be able to handle whatever is in that
locale slot, even if it makes no sense, or at least give a more useful
error message?

I don't think it's reasonable to ask perl to do anything sensible or helpful when presented with a decimal_point this silly.
--
Dominic Dunlop

Reply via email to