This is unrelated. The framework allows us to do it, if we want to use
it, we'll use it. The problem is more with the fact that you can't use
non-thousands-separated numbers and you can't use thousand-separated
numbers either because you'd have to input a non-breakable space as a
separator. The problem is more with the fact that you can't input either
8000 or 8 000. Just 8(\xA0)000.
Regards,
- Nicolas Grevet
Hector Virgen wrote:
I might be wrong, but I don't think a user-inputted string of
"8[space]000" is considered an Integer. In order to use the Int
validator, you'll need to filter the input to remove all non-integer
characters.
When it comes to displaying the number back to the user (for example, in
a view template), you can use the built-in number_format() function to
make an int human-readable.
--
Hector
On Tue, Feb 23, 2010 at 8:54 AM, Nicolas Grevet <[email protected]
<mailto:[email protected]>> wrote:
Hello,
I repeat the question: Is Zend_Validate_Int seriously broken with
non-english locales or is it just me? Because we're facing two
different problems.
* In order to validate an integer using the french format (with
spaces as thousands separator, ie: 8 000), the framework expects us
to input digits separated with non-breakable spaces (ie:
8(\xA0)000). Is this a sad joke? Because I don't even know how to
input a non-breakable space using my keyboard. Regular spaces are
*not* allowed. Sure you can still avoid thousands separators, but in
this case, a second problem appears..
(this issue is discussed here, I can understand it's not really an
issue, but still: http://framework.zend.com/issues/browse/ZF-7175)
* So you can't validate a french space-separated number, let's use a
number with no separators at all. Unfortunately, that does not seem
to be a solution either, since you didn't specified the 'u' modifier
in the preg_match() that validates the number format in
Zend_Locale_Format (line 503). And it seems that the non-breakable
space is a special UTF-8 character that you can't use in UTF-8 regex
without the 'u' modifier. At least, adding the 'u' modifier makes it
work like a charm.
So basically, you can't use integers in french.
What are we supposed to do?
I filed an issue there:
http://framework.zend.com/issues/browse/ZF-9242
Regards,
- Nicolas Grevet