A json_encode issue in PHP

I found json_encode threw errors because of the “™” characters in the string retrieved from database. You can fix it when you retrieve the data from database (mysql). Here is the solution:

$res = mysqli_query($gDB, 'SELECT age,carrier,id,imageUrl,CAST(CONVERT(name USING utf8) AS BINARY) AS name,CAST(CONVERT(snippet USING utf8) AS BINARY) AS snippet FROM ' . $table);

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply