diff options
author | Andrew Dolgov <[email protected]> | 2013-07-14 22:19:59 -0700 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-07-14 22:19:59 -0700 |
commit | 2aaff3b0da7c6faa39f24d3f24e263e7d17d9b3d (patch) | |
tree | 12fb80df0b1c607cacbd6fa113e2ea87800869f7 | |
parent | 0971cc619d302bad27fcd540fe59426299710ceb (diff) | |
parent | f8160106af762da1a2f4b4a2579b8165cb2005e2 (diff) |
Merge pull request #267 from wltb/master
Feedparser constructor/encoding change
-rw-r--r-- | classes/feedparser.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/classes/feedparser.php b/classes/feedparser.php index 53f6c52a9..651ee010f 100644 --- a/classes/feedparser.php +++ b/classes/feedparser.php @@ -22,13 +22,13 @@ class FeedParser { // libxml compiled without iconv? if ($error && $error->code == 32) { - if (preg_match('/^(<\\?xml .*?)encoding="(.+?)"(.*?\\?>)/', $data, $matches) === 1) { + if (preg_match('/^(<\?xml[\t\n\r ].*?encoding=["\'])(.+?)(["\'].*?\?>)/s', $data, $matches) === 1) { libxml_clear_errors(); $enc = $matches[2]; - $data = iconv($enc, 'UTF-8//IGNORE', $data); - $data = preg_replace('/^<\\?xml .*?\\?>/', $matches[1] . $matches[3] , $data); + $data = iconv($enc, 'UTF-8//IGNORE', $data); + $data = preg_replace('/^<\?xml[\t\n\r ].*?\?>/s', $matches[1] . "UTF-8" . $matches[3] , $data); $this->doc = new DOMDocument(); $this->doc->loadXML($data); |