note 117466 added to json.constants
| From: | Anonymous | Date: | Sat, 13 Jun 2015 19:59:02 +0000 |
| Subject: | note 117466 added to json.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202856@lists.php.net to get a copy of this message | ||
I am working with "Marathi Language Data" and I found that when I encoded Marathi data to
json using json_encode it returned me unicode values of each character like below:
Program :
<?php
$ar = array("word" => "धाडस");
echo json_encode($ar);
?>
Output of program is :
{"word":"\u0927\u093e\u0921\u0938"}
This is not expected output because what I need is output as
{"word":"धाडस"}
So I used following code:
<?php
$ar = array("word" => "धाडस");
echo json_encode($ar, JSON_UNESCAPED_UNICODE);
?>
And I got the required output as :
{"word":"धाडस"}
----
Server IP: 72.52.91.14
Probable Submitter: 1.39.96.62
----
Manual Page -- http://php.net/manual/en/json.constants.php
Edit -- https://master.php.net/note/edit/117466
Del: integrated -- https://master.php.net/note/delete/117466/integrated
Del: useless -- https://master.php.net/note/delete/117466/useless
Del: bad code -- https://master.php.net/note/delete/117466/bad+code
Del: spam -- https://master.php.net/note/delete/117466/spam
Del: non-english -- https://master.php.net/note/delete/117466/non-english
Del: in docs -- https://master.php.net/note/delete/117466/in+docs
Del: other reasons-- https://master.php.net/note/delete/117466
Reject -- https://master.php.net/note/reject/117466
Search -- https://master.php.net/manage/user-notes.php