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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC