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 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 11:01:31 2025 UTC