From 316778ef47394b27047abd9c9a739c34d2fd3829 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 7 Nov 2013 19:27:52 +0100 Subject: Un morceau de tolérance XML oublié MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/SimplePie/SimplePie.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/SimplePie/SimplePie.php') diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index b33c635f1..9e532023a 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1311,8 +1311,10 @@ class SimplePie { $encodings[] = strtoupper($charset[1]); } - $encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry))); - $encodings[] = 'UTF-8'; + else + { + $encodings[] = ''; //Let the DOM parser decide first + } } elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') { @@ -1320,6 +1322,10 @@ class SimplePie { $encodings[] = $charset[1]; } + else + { + $encodings[] = ''; + } $encodings[] = 'US-ASCII'; } // Text MIME-type default @@ -1341,7 +1347,7 @@ 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 : $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8'))) { // Create new parser $parser = $this->registry->create('Parser'); -- cgit v1.2.3