ZF-6683: Zend_Locale_Format::getNumber() parses French thousands separator incorrectly

Issue Type: Bug Created: 2009-05-15T16:19:49.000+0000 Last Updated: 2009-05-23T14:09:18.000+0000 Status: Resolved Fix version(s): Reporter: Vahe Oughourlian (jedcred) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


In many French locales it is correct to use a space as a thousands separator. As an example, the US English method of writing 1,000,000 in French Canada is 1 000 000.

The output of Zend_Locale_Format::getNumber('1 324',array('locale' => 'fr_CA') is 1 as opposed to the correct 1324. Naturally this is a simplified example; the typical use case is to take a locale specific string (possibly with currency indicators) and convert it into a number that can be compared etc, which works fine in other locales, such as the German locale that uses periods as thousands separators.

Workaround is to strip spaces out of all inputs to getNumber ATM.


Posted by Thomas Weidner (thomas) on 2009-05-23T14:07:45.000+0000

According to CLDR the grouping character for 'fr' is a chr(/u00A0) and not chr(/u0020). Using the proper grouping character, the numbers are recognised as expected.


<pre class="highlight">
var_dump(Zend_Locale_Format::getNumber('1 324',array('locale' => 'fr_CA')));

Note that even if it looks like the digits are seperated by a space, it's another character (A0 instead of 20) which is not a space but a "no-break-space".

Note also that this is defined by CLDR and not by ZF as grouping character for the locale 'fr'

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.