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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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: Fri Apr 26 06:01:32 2024 UTC