php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45232 json_decode() doesn't decode special characters
Submitted: 2008-06-11 09:46 UTC Modified: 2008-06-11 09:51 UTC
From: crazed007 at gmail dot com Assigned:
Status: Not a bug Package: JSON related
PHP Version: 5.2.6 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: crazed007 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-06-11 09:46 UTC] crazed007 at gmail dot com
Description:
------------
When decoding a JSON encoded string which contains a special character like ? or ?, json_decode() returns a null.

Reproduce code:
---------------
$foo = '[{"city":"gen?ve"}]';
$obj = json_decode($foo);
var_dump($obj);

Expected result:
----------------
array
  0 => 
    object(stdClass)[1]
      public 'city' => string 'gen?ve' (length=6)


Actual result:
--------------
null

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-11 09:51 UTC] derick@php.net
Not a bug, JSON needs to be UTF-8 encoded.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 11:01:28 2025 UTC