Bug #53791 [Com]: NumberFormat::parse fail with French thousands separator

From: Date: Wed, 19 Jan 2011 18:50:40 +0000
Subject: Bug #53791 [Com]: NumberFormat::parse fail with French thousands separator
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-158016@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53791&edit=1

 ID:                 53791
 Comment by:         jinmoku at hotmail dot com
 Reported by:        jinmoku at hotmail dot com
 Summary:            NumberFormat::parse fail with French thousands
                     separator
 Status:             Feedback
 Type:               Bug
 Package:            I18N and L10N related
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

I can't try now, but I tested on my OSX with php 5.3.5 and ICU 4.6, and
I have :

string(6) "1 234"
float(1)
float(1234.56)


Previous Comments:
------------------------------------------------------------------------
[2011-01-19 18:23:26] pajoye@php.net

Looks to me like an ICU problem then.

Please try VC9 builds on Windows instead of VC6, as we use 3.8.x instead
of 3.6.

------------------------------------------------------------------------
[2011-01-19 18:05:28] jinmoku at hotmail dot com

intl 1.1.0 icu 3.6 and win 7

On debian dotdeb php 5.2.14 with icu 3.8.1 (intl 1.0.3), I have :

string(9) "1Â 234,56"
float(1)
float(1234.56)

------------------------------------------------------------------------
[2011-01-19 16:55:19] pajoye@php.net

Which ICU version do you use?

------------------------------------------------------------------------
[2011-01-19 16:52:43] jinmoku at hotmail dot com

Description:
------------
NumberFormat::parse fail with French thousands separator (space)

Test script:
---------------
$nombre = '1234,56';
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
var_dump($fmt->format($nombre));

$nombre = '1 234,56';
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
var_dump($fmt->parse($nombre));

$nombre = '1234,56';
$fmt = new NumberFormatter('fr_FR', NumberFormatter::DECIMAL);
var_dump($fmt->parse($nombre));

Expected result:
----------------
string(9) "1 234,56"
float(1234.56)
float(1234.56)


Actual result:
--------------
string(9) "1 234,56"
float(1)
float(1234.56)



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53791&edit=1


Thread (15 messages)

« previous php.bugs (#158016) next »