On Sun, Jun 05, 2005 at 12:41:04PM +0200, Dominic Dunlop wrote:

> 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).

Yes, I'd say it's an apple bug. It might actually be in printf. Here's a
pure C test case:

$ cat locale.c 
#include <stdio.h>
#include <locale.h>

int main(int argc, char **argv) {
  char *locale;
  while((locale = *++argv)) {
    struct lconv *l;

    if (!setlocale(LC_NUMERIC, locale)) {
      printf("setlocale for '%s' failed\n", locale);
      continue;
    }
    l = localeconv();
    printf ("locale >%s<, separator = >%s<, 1.23 prints as >%.3g<\n",
            locale, l->decimal_point, 1.23);
  }
  return 0;
}
$ ./locale eu_ES
locale >eu_ES<, separator = >' <, 1.23 prints as >1'23<


If it's not a bug, I'd like to know why the C standard lets you skip putting
the space in the string in printf.

Nicholas Clark

Reply via email to