rework magpie encoding fix patch

This commit is contained in:
Andrew Dolgov 2007-08-13 07:08:55 +01:00
parent bba7c4bf21
commit af856f1598

View file

@ -141,11 +141,18 @@ class MagpieRSS {
xml_parser_free( $this->parser ); xml_parser_free( $this->parser );
if (preg_match('/<\?xml.*?encoding="([^ ]+)".*?\?>/',
$source, $matches)) {
$enc = $matches[1];
} else {
$enc = mb_detect_encoding($string);
}
list($parser, $source) = $this->create_parser($source, list($parser, $source) = $this->create_parser($source,
$output_encoding, $input_encoding, $detect_encoding); $output_encoding, $input_encoding, $detect_encoding);
$source = mb_convert_encoding($source, "UTF-8", $source = mb_convert_encoding($source, "UTF-8", $enc);
mb_detect_encoding($source));
$this->parser = $parser; $this->parser = $parser;