Doc #60083 [Csd]: NumberFormatter::formatCurrency wrong for CHF (Swiss Francs)

From: Date: Mon, 07 Jul 2014 07:03:55 +0000
Subject: Doc #60083 [Csd]: NumberFormatter::formatCurrency wrong for CHF (Swiss Francs)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11347@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60083&edit=1 ID: 60083 Updated by: stas@php.net Reported by: gman at xrbr dot com Summary: NumberFormatter::formatCurrency wrong for CHF (Swiss Francs) Status: Closed Type: Documentation Problem Package: intl Operating System: SuSE Linux PHP Version: 5.3.8 Assigned To: stas Block user comment: N Private report: N New Comment: Looks like it's working fine with latest PHP and ICU. Previous Comments: ------------------------------------------------------------------------ [2014-07-07 07:03:12] stas@php.net Looks like it's working fine with latest PHP and ICU. ------------------------------------------------------------------------ [2014-07-06 23:17:29] php at deep-freeze dot ca Works as expected with PHP 5.4.21 / ICU 53 $nf = new NumberFormatter("de-DE", NumberFormatter::CURRENCY); var_dump($nf->formatCurrency(12.99, "CHF")); Actual Result: -------------- string(10) "12,99 CHF" ------------------------------------------------------------------------ [2011-10-19 14:25:50] johannes@php.net Re-Opening this as this should be made clear in the documentation. Can be quite unexpected. ------------------------------------------------------------------------ [2011-10-18 10:29:59] gman at xrbr dot com They do not have "1 Rappen" coins! That is the reason. ------------------------------------------------------------------------ [2011-10-18 10:26:53] gman at xrbr dot com Description: ------------ I am not from Switzerland, but as far as I know they do have "Rappen", and 1 CHF is equal to 100 Rappen. So putting float 12.99 to NumberFormatter::formatCurrency should return the said 12,99 ("," is the correct decimal separator for de_DE), but what it does is to output 13,00 which is not correct! Test script: --------------- $varNumberFormatter1 = new NumberFormatter("de_DE", NumberFormatter::CURRENCY); var_dump($varNumberFormatter1->formatCurrency(12.99, "CHF")); $varNumberFormatter2 = new NumberFormatter("de_DE", NumberFormatter::CURRENCY); var_dump($varNumberFormatter2->formatCurrency(12.99, "EUR")); Expected result: ---------------- string(10) "12,99 CHF" string(10) "12,99 €" Actual result: -------------- string(10) "13,00 CHF" string(10) "12,99 €" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60083&edit=1

« previous php.doc.bugs (#11347) next »