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


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.


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.


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'