diff options
| author | 2016-10-20 23:10:15 +0200 | |
|---|---|---|
| committer | 2016-10-20 23:10:15 +0200 | |
| commit | 0a3ab899a01cc20919881f913619ade9e6cdfba5 (patch) | |
| tree | bb0e507f7199e566ff68ea96f6fcdfb8ced5b38b /lib/SimplePie | |
| parent | 8a45743b9036078344ea362b183358f8ca8e4dd3 (diff) | |
Add support for UTF-8 BOM in SimplePie feed_or_html()
https://github.com/FreshRSS/FreshRSS/issues/1336
Diffstat (limited to 'lib/SimplePie')
| -rw-r--r-- | lib/SimplePie/SimplePie/Content/Type/Sniffer.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/SimplePie/SimplePie/Content/Type/Sniffer.php b/lib/SimplePie/SimplePie/Content/Type/Sniffer.php index daec3607d..ec0bf0952 100644 --- a/lib/SimplePie/SimplePie/Content/Type/Sniffer.php +++ b/lib/SimplePie/SimplePie/Content/Type/Sniffer.php @@ -256,7 +256,12 @@ class SimplePie_Content_Type_Sniffer public function feed_or_html() { $len = strlen($this->file->body); - $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); + $pos = 0; + if (isset($this->file->body[2]) && $this->file->body[0] === "\xEF" && + $this->file->body[1] === "\xBB" && $this->file->body[2] === "\xBF") { + $pos += 3; //UTF-8 BOM + } + $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos); while ($pos < $len) { |
