I'm using the YouTube API to grab comments from videos in JSON, using the following code:
$url = 'https://gdata.youtube.com/feeds/api/videos/' . $video_id .'/comments?alt=json&max-results=50&v=2';
$comments = array();
$json = file_get_contents($url);
$data = json_decode($json, TRUE);
foreach($data["feed"]["entry"] as $item)
{
array_push($comments, $item["content"]['$t']);
}
However there is some kind of character encoding problem as I keep getting '
' in the comments - usually at the end of a sentence/comment.
Any ideas on how to read the JSON using the correct ASCII character encoding?