[Bug localedata/23791] Wrong monetary format for ca_ES locale

rbuj at fedoraproject dot org sourceware-bugzilla@sourceware.org
Fri Oct 26 19:25:00 GMT 2018


https://sourceware.org/bugzilla/show_bug.cgi?id=23791

--- Comment #14 from Robert Buj <rbuj at fedoraproject dot org> ---
——————————————————————————
Issue
——————————————————————————
The currency symbol succeeds the value in Catalan.

[robert@localhost ~]$ uname -a
Linux localhost.localdomain 4.18.16-200.fc28.x86_64 #1 SMP Sat Oct 20 23:53:47
UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[robert@localhost ~]$ LANG=C dnf info glibc
Name         : glibc
Version      : 2.27
Release      : 33.fc28
Arch         : x86_64
Size         : 13 M
Source       : glibc-2.27-33.fc28.src.rpm
...

——————————————————————————
Test code
——————————————————————————
[robert@localhost ~]$ cat test.c 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <monetary.h>
#include <locale.h>

int main () {
   struct lconv * lc;
   char string[100];
   double money = -1234.56;

   if (setlocale(LC_ALL, "ca_ES.UTF-8") == NULL) {
      printf("Unable to setlocale().\n");
      exit(1);
   }

   lc = localeconv();
   printf("Currency symbol: [%s]\n",lc->currency_symbol);
   printf("International currency symbol: [%s]\n",lc->int_curr_symbol);
   printf("Currency decimal point: [%s]\n",lc->mon_decimal_point);
   printf("Currency thousands sep: [%s]\n",lc->mon_thousands_sep);
   printf("Positie currency symbol precedes?: [%d]\n",lc->p_cs_precedes);
   printf("Negative currency symbol precedes?: [%d]\n",lc->n_cs_precedes);

   strfmon(string, 100, "%i", fabs(money)); /* 1.234,56 EUR */
   printf("[%s]\n", string);

   strfmon(string, 100, "%n", fabs(money)); /* 1.234.56 € */
   printf("[%s]\n", string);

   strfmon(string, 100, "%i", money); /* -1.234,56 EUR */
   printf("[%s]\n", string);

   strfmon(string, 100, "%n", money); /* -1.234.56 € */
   printf("[%s]\n", string);

   return 0;
}

——————————————————————————
Current result
——————————————————————————
[robert@localhost ~]$ ./test 
Currency symbol: [€]
International currency symbol: [EUR ]
Currency decimal point: [,]
Currency thousands sep: [.]
Positie currency symbol precedes?: [1]
Negative currency symbol precedes?: [1]
[EUR 1.234,56]
[€ 1.234,56]
[-EUR 1.234,56]
[-€ 1.234,56]

——————————————————————————
Expected result
——————————————————————————
[robert@localhost ~]$ ./test 
Currency symbol: [€]
International currency symbol: [EUR ]
Currency decimal point: [,]
Currency thousands sep: [.]
Positie currency symbol precedes?: [0]
Negative currency symbol precedes?: [0]
[1.234,56 EUR]
[1.234,56 €]
[-1.234,56 EUR]
[-1.234,56 €]

——————————————————————————
Patch
——————————————————————————
[robert@localhost f28]$ cat my.patch 
diff -urN glibc-2.27-78-g2b47bb9cba/localedata/locales/ca_ES
glibc-2.27-78-g2b47bb9cba-p/localedata/locales/ca_ES
--- glibc-2.27-78-g2b47bb9cba/localedata/locales/ca_ES  2018-10-26
21:21:37.670258359 +0200
+++ glibc-2.27-78-g2b47bb9cba-p/localedata/locales/ca_ES        2018-10-26
21:20:12.166974111 +0200
@@ -69,7 +69,7 @@

 LC_MONETARY
 int_curr_symbol      "EUR "
-currency_symbol      "<U20AC>"
+currency_symbol      "€"
 mon_decimal_point    ","
 mon_thousands_sep    "."
 mon_grouping         3;3
@@ -77,9 +77,9 @@
 negative_sign        "-"
 int_frac_digits      2
 frac_digits          2
-p_cs_precedes        1
+p_cs_precedes        0
 p_sep_by_space       1
-n_cs_precedes        1
+n_cs_precedes        0
 n_sep_by_space       1
 p_sign_posn          1
 n_sign_posn          1

——————————————————————————
Note
——————————————————————————
int_curr_symbol: The fourth character is the character used to separate the
international currency symbol from the monetary quantity.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libc-locales mailing list