[Bug localedata/2420] New: de_CH: negative number formatting

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] New: de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
Negative numbers don't get a leading "-" when formatted as a (financial)
number like with other locales.

Expected result: -12.34
Actual result: 12.34

--
           Summary: de_CH: negative number formatting
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: localedata
        AssignedTo: libc-locales at sources dot redhat dot com
        ReportedBy: thomas dot schwanhaeuser at aps-web dot de
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de

------- Additional Comments From barbier at linuxfr dot org  2006-03-07 21:12 -------
I cannot reproduce your bug.  Can you please tell how you print
this negative amount?


--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From thomas dot schwanhaeuser at aps-web dot de  2006-03-08 11:51 -------
(In reply to comment #1)
> I cannot reproduce your bug.  Can you please tell how you print
> this negative amount?

Here is a PHP script as a demo.

If I run it, I get this as an output:

Pos:  123 456.00
Neg: 123 456.00
 Switching to locale de_DE
Pos:  123.456,00
Neg: -123.456,00




Script:

<?PHP
$posnumber=123456; $negnumber=$posnumber*(-1);

setlocale (LC_ALL, 'de_CH');
print "Pos: ".money_format('',$posnumber)."\n";
print "Neg: ".money_format('',$negnumber);

print "\n Switching to locale de_DE \n";

setlocale(LC_ALL, 'de_DE');
print "Pos: ".money_format('',$posnumber)."\n";
print "Neg: ".money_format('',$negnumber);


?>




--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From thomas dot schwanhaeuser at aps-web dot de  2006-03-08 11:53 -------
Please also note, that for de/fr/it_CH formatting it should be "123'456"
instead of "123 456". See http://sourceware.org/bugzilla/show_bug.cgi?id=2349 
for more details.

--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From barbier at linuxfr dot org  2006-03-08 19:55 -------
> print "Pos: ".money_format('',$posnumber)."\n";
> print "Neg: ".money_format('',$negnumber);

These commands print nothing here; according to PHP documentation,
the first argument of money_format cannot be empty, it must contain
%i or %n with optional attributes.
The minus sign is then printed as expected, so it seems that there
is no bug.


--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From barbier at linuxfr dot org  2006-03-10 06:54 -------
After more explanations from Thomas, I can confirm that there is indeed a bug
with strfmon and the ! modifier. Here is a test case.
  Expected result: Fr.- 12.34 - 12.34
  Actual result: Fr.- 12.34 12.34

#include <monetary.h>
#include <locale.h>
#include <stdio.h>

int main()
{
        char buf[500];
        setlocale(LC_ALL, "de_CH.UTF-8");
        strfmon(buf, sizeof(buf), "%n %!n\n", -12.34, -12.34);
        printf("%s", buf);
        return 0;
}


--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From barbier at linuxfr dot org  2006-03-10 12:47 -------
Created an attachment (id=909)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=909&action=view)
Fix strfmon to not omit the negative sign

Note: this patch does not modify indentation to improve its readability.


--


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug localedata/2420] de_CH: negative number formatting

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de

------- Additional Comments From drepper at redhat dot com  2006-04-26 05:15 -------
Should be fixed in CVS.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2420

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.