|  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
 [2007-09-01 17:05 UTC] salo at laborint dot com
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:

Expected result:
{"float_test": 10.12345}

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


Add a Patch

Pull Requests

Add a Pull Request


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]
This was fixed in 5.2.5.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Sep 27 01:05:53 2022 UTC