Skip to content
This repository
Browse code

Make sure the encoding is on mbstring's list of supported encodings b…

…efore trying to convert.

Thanks to mattfaulds on GitHub, and solarissmoke on WordPress Trac for patches.
  • Loading branch information...
commit cce56bb6809de9301909204c40c8a4f13ec322fe 1 parent 174fd6c
Ryan McCue authored April 06, 2011

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  simplepie.inc
2  simplepie.inc
@@ -9461,7 +9461,7 @@ class SimplePie_Misc
9461 9461
 			return SimplePie_Misc::windows_1252_to_utf8($data);
9462 9462
 		}
9463 9463
 		// This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
9464  
-		elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
  9464
+		elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && in_array($input, mb_list_encodings()) && ($return = @mb_convert_encoding($data, $output, $input)))
9465 9465
 		{
9466 9466
 			return $return;
9467 9467
 		}

0 notes on commit cce56bb

Please sign in to comment.
Something went wrong with that request. Please try again.