protected function morph($content) { $encoding = mb_detect_encoding($content, array('utf-8', 'iso-8859-1', 'windows-1251')); if ($encoding !== 'UTF-8') { $content = iconv($encoding, 'UTF-8', $content); } return Utils::parseJson($content); }
protected function parseJSON($content, $detectEncoding = array('utf-8', 'iso-8859-1', 'windows-1251')) { if (!empty($detectEncoding)) { $encoding = mb_detect_encoding($content, $detectEncoding); if ($encoding !== 'UTF-8') { $content = iconv($encoding, 'UTF-8', $content); } } return Utils::parseJson($content); }