From 7524609f3fa487941e829e2f10117d2ea08f3200 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 7 Nov 2014 14:44:33 +0100 Subject: try to fix encoding --- articleenhancer/xpatharticleenhancer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'articleenhancer') 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)); } -- cgit v1.2.3