#40360 [Opn->Csd]: current locale affects how json_encode encodes floats
| From: | ftl_ at freemail dot hu | Date: | Mon, 05 Feb 2007 03:16:38 +0000 |
| Subject: | #40360 [Opn->Csd]: current locale affects how json_encode encodes floats | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108400@lists.php.net to get a copy of this message | ||
ID: 40360
User updated by: ftl_ at freemail dot hu
Reported By: ftl_ at freemail dot hu
-Status: Open
+Status: Closed
Bug Type: Variables related
Operating System: Gentoo Linux
PHP Version: 5.2.0
New Comment:
fixed in PHP 5.2.1RC5-dev (cli) (built: Feb 5 2007 00:22:58)
(sorry for this thoughtless bugreport.)
Previous Comments:
------------------------------------------------------------------------
[2007-02-05 02:09:28] ftl_ at freemail dot hu
Description:
------------
json_encode is using the decimal separator of the current locale
instead of using "."
(similar to http://bugs.php.net/bug.php?id=40235)
Reproduce code:
---------------
<?php
var_dump(json_encode(1.2));
setlocale(LC_NUMERIC, 'hu_HU');
var_dump(json_encode(1.2));
?>
Expected result:
----------------
string(3) "1.2"
string(3) "1.2"
Actual result:
--------------
string(3) "1.2"
string(3) "1,2"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40360&edit=1