diff options
| author | 2014-02-17 00:15:42 +0100 | |
|---|---|---|
| committer | 2014-02-17 00:15:42 +0100 | |
| commit | d51048196bdddd9909d88cef05d3ebdfaac36234 (patch) | |
| tree | 488b75fc92066bd6adb0755e2bec3201ae98323b /lib | |
| parent | 0d387081df39282c087c95a430634fe2b2444059 (diff) | |
Revert "SimplePie : tolérance caractères UTF-8 invalides"
This reverts commit 7e66db7782b7fa7f7262a70ccea5c377341886cd.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/SimplePie/SimplePie.php | 3 | ||||
| -rw-r--r-- | lib/SimplePie/SimplePie/Parser.php | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index 99e84901b..d7aaeb0c5 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1382,7 +1382,8 @@ class SimplePie foreach ($encodings as $encoding) { // Change the encoding to UTF-8 (as we always use UTF-8 internally) - if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) + if ($utf8_data = (empty($encoding) || $encoding === 'UTF-8') ? $this->raw_data : //FreshRSS + $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) { // Create new parser $parser = $this->registry->create('Parser'); diff --git a/lib/SimplePie/SimplePie/Parser.php b/lib/SimplePie/SimplePie/Parser.php index 8a80f4b25..9300b4ba9 100644 --- a/lib/SimplePie/SimplePie/Parser.php +++ b/lib/SimplePie/SimplePie/Parser.php @@ -145,6 +145,10 @@ class SimplePie_Parser $dom->loadXML($data); $this->encoding = $encoding = $dom->encoding = 'UTF-8'; $data2 = $dom->saveXML(); + if (function_exists('mb_convert_encoding')) + { + $data2 = mb_convert_encoding($data2, 'UTF-8', 'UTF-8'); + } if (strlen($data2) > (strlen($data) / 2.0)) { $data = $data2; |
