note 85980 added to function.json-decode
| From: | jrevillini at osu1 dot php dot net | Date: | Fri, 26 Sep 2008 19:01:44 +0000 |
| Subject: | note 85980 added to function.json-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144822@lists.php.net to get a copy of this message | ||
When decoding strings from the database, make sure the input was encoded with the correct charset
when it was input to the database.
I was using a form to create records in the DB which had a content field that was valid JSON, but it
included curly apostrophes. If the page with the form did not have
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
in the head, then the data was sent to the database with the wrong encoding. Then, when json_decode
tried to convert the string to an object, it failed every time.
----
Server IP: 208.69.120.35
Probable Submitter: 155.43.81.98
----
Manual Page -- http://www.php.net/manual/en/function.json-decode.php
Edit -- https://master.php.net/note/edit/85980
Del: integrated -- https://master.php.net/note/delete/85980/integrated
Del: useless -- https://master.php.net/note/delete/85980/useless
Del: bad code -- https://master.php.net/note/delete/85980/bad+code
Del: spam -- https://master.php.net/note/delete/85980/spam
Del: non-english -- https://master.php.net/note/delete/85980/non-english
Del: in docs -- https://master.php.net/note/delete/85980/in+docs
Del: other reasons-- https://master.php.net/note/delete/85980
Reject -- https://master.php.net/note/reject/85980
Search -- https://master.php.net/manage/user-notes.php