php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57819 json_encode outputs floats with commas instead of dots with certain locales
Submitted: 2007-09-01 17:05 UTC Modified: 2008-12-18 21:27 UTC
From: salo at laborint dot com Assigned:
Status: Closed Package: json (PECL)
PHP Version: 5.2.1 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: salo at laborint dot com
New email:
PHP Version: OS:

 

 [2007-09-01 17:05 UTC] salo at laborint dot com
Description:
------------
If you do setlocale("estonia") on a windows machine then json_encode outputs floats with commas which will cause a parse error in all browsers. It should output dots

Reproduce code:
---------------
setlocale("estonia");
json_encode(array('float_test'=>10.12345));

Expected result:
----------------
{"float_test": 10.12345}

Actual result:
--------------
{"float_test": 10,12345}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-21 09:05 UTC] jb at fragp dot com
Same problem here with setlocale("de"); and json_encode of a float.
 [2008-12-18 21:27 UTC] scottmac@php.net
This was fixed in 5.2.5.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 04:01:31 2024 UTC