Skip to content

Commit

Permalink
Make sure the encoding is on mbstring's list of supported encodings b…
Browse files Browse the repository at this point in the history
…efore trying to convert.

Thanks to mattfaulds on GitHub, and solarissmoke on WordPress Trac for patches.
  • Loading branch information
rmccue committed Apr 6, 2011
1 parent 174fd6c commit cce56bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion simplepie.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9461,7 +9461,7 @@ class SimplePie_Misc
return SimplePie_Misc::windows_1252_to_utf8($data);
}
// This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
elseif (function_exists('mb_convert_encoding') && @mb_convert_encoding("\x80", 'UTF-16BE', $input) !== "\x00\x80" && ($return = @mb_convert_encoding($data, $output, $input)))
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)))
{
return $return;
}
Expand Down

0 comments on commit cce56bb

Please sign in to comment.