Skip to content

Commit

Permalink
fix for json parsing when special characters in feed content
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Mar 2, 2016
1 parent 472dc48 commit 0750f30
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion feedme/services/FeedMe_FeedJSONService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ public function getFeed($url, $primaryElement) {
return false;
}

// Perform cleanup on raw data first
$raw_content = preg_replace("/[\r\n]+/", " ", $raw_content);
$json = utf8_encode($raw_content);

// Parse the JSON string
$json_array = json_decode($raw_content, true);
$json_array = json_decode($json, true);

// Look for and return only the items for primary element
$json_array = craft()->feedMe_feed->findPrimaryElement($primaryElement, $json_array);
Expand Down

0 comments on commit 0750f30

Please sign in to comment.