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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 08:01:35 2019 UTC