Просмотр исходного кода

SimplePie : tolérance caractères UTF-8 invalides

Meilleure implémentation de
https://github.com/marienfressinaud/FreshRSS/commit/f5251384c40fbf16c2b7f448884d7583b0119e7a
pour corriger https://github.com/marienfressinaud/FreshRSS/issues/419
Revert partiel de
https://github.com/marienfressinaud/FreshRSS/commit/316778ef47394b27047abd9c9a739c34d2fd3829#diff-d8be58dcfea709da6131af81563c5c9fR1350
Alexandre Alapetite 12 лет назад
Родитель
Сommit
7e66db7782
2 измененных файлов с 1 добавлено и 6 удалено
  1. 1 2
      lib/SimplePie/SimplePie.php
  2. 0 4
      lib/SimplePie/SimplePie/Parser.php

+ 1 - 2
lib/SimplePie/SimplePie.php

@@ -1372,8 +1372,7 @@ class SimplePie
 		foreach ($encodings as $encoding)
 		{
 			// Change the encoding to UTF-8 (as we always use UTF-8 internally)
-			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')))
+			if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8')))
 			{
 				// Create new parser
 				$parser = $this->registry->create('Parser');

+ 0 - 4
lib/SimplePie/SimplePie/Parser.php

@@ -145,10 +145,6 @@ 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;