feedparser: fix normalize_encoding() not working properly for some encodings

master
Andrew Dolgov 8 years ago
parent 3bba9c396f
commit 4a5490dc58

@ -18,7 +18,7 @@ class FeedParser {
$encoding = strtolower($matches[2]); $encoding = strtolower($matches[2]);
if (in_array($encoding, mb_list_encodings())) if (in_array($encoding, array_map('strtolower', mb_list_encodings()))) {
$data = mb_convert_encoding($data, 'UTF-8', $encoding); $data = mb_convert_encoding($data, 'UTF-8', $encoding);
$data = preg_replace('/^<\?xml[\t\n\r ].*?\?>/s', $matches[1] . "UTF-8" . $matches[3] , $data); $data = preg_replace('/^<\?xml[\t\n\r ].*?\?>/s', $matches[1] . "UTF-8" . $matches[3] , $data);

Loading…
Cancel
Save