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
I cannot reproduce your bug. Can you please tell how you print this negative amount?
(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); ?>
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.
> 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.
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; }
Created attachment 909 [details] Fix strfmon to not omit the negative sign Note: this patch does not modify indentation to improve its readability.
Should be fixed in CVS.