diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-07 14:44:33 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-11-07 14:44:33 +0100 |
commit | 7524609f3fa487941e829e2f10117d2ea08f3200 (patch) | |
tree | a7c566d003bfa490df391e77981987de90f98b3a | |
parent | 7f81afd7efbeb931d16ce1f3a1ed53a54226d553 (diff) |
try to fix encoding
-rw-r--r-- | articleenhancer/xpatharticleenhancer.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index 5a950e649..c48237367 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -17,6 +17,8 @@ use \DOMDocument; use \DOMXpath; use \ZendXml\Security; +use \PicoFeed\Encoding\Encoding; + use \OCA\News\Utility\PicoFeedClientFactory; use \OCA\News\Db\Item; @@ -49,9 +51,10 @@ class XPathArticleEnhancer implements ArticleEnhancer { foreach($this->regexXPathPair as $regex => $search) { if(preg_match($regex, $item->getUrl())) { - list($body, $contentType) = $this->getFile($item->getUrl()); + list($body, $httpEncoding) = $this->getFile($item->getUrl()); if(preg_match('/(?<=charset=)[^;]*/', $body, $matches)) { $encoding = $matches[0]; + $body = Encoding::convert($body, $encoding); $body = mb_convert_encoding($body, 'HTML-ENTITIES', strtoupper($encoding)); } |