ZF-7175: Localization of number use 0xC2A0 instead [space] character

Issue Type: Bug Created: 2009-07-01T15:31:35.000+0000 Last Updated: 2009-07-01T22:45:48.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Dmitry Pereslegin (dvp) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:



This problem block user input of localized numbers with spaces, bacause Zend_Locale_Format::isNumber return false on its.


<pre class="highlight">
$options = array(
    'locale' => 'ru'

$normalized = '1111'; // string(4) "1 111"
$localizedByMe = '1 111'; // string(5) "1 111"

$localizedByFilter = Zend_Locale_Format::toNumber($normalized, $options); // string(6) "1 111" - 6, not 5

for ($i=0; $i


Posted by Thomas Weidner (thomas) on 2009-07-01T22:44:43.000+0000

This is not a failure. This locale, and also french for example, define that the separation must be done with a "non-breaking" space.

The reason behind this is simple:

Think of a number at the end of a line when usng a automated line break. The 1 would be at line 1, and the 111 would be at line 2. So for your user it would seem that you have 2 numbers.

So when using a space as separation, the given input will be recognised as 2 different numbers which, of course, means that false will be returned.

This is expected and correct behaviour.

When you have to work with localized userinput and want to convert spaces in non-breaking spaces, you should use for example a regex filter to change the character. Or your input field changes this itself.

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.