diff options
author | Andrew Dolgov <[email protected]> | 2007-08-13 07:08:55 +0100 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2007-08-13 07:08:55 +0100 |
commit | af856f1598342fe495306dff996b07eda4a9a7dd (patch) | |
tree | ff0cf50578ded1a7d21c86831ffa23128b2969e6 /magpierss/rss_parse.inc | |
parent | bba7c4bf21385151b7f6649d07d54e9e1b4f8b6a (diff) |
rework magpie encoding fix patch
Diffstat (limited to 'magpierss/rss_parse.inc')
-rw-r--r-- | magpierss/rss_parse.inc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/magpierss/rss_parse.inc b/magpierss/rss_parse.inc index 8a67523b5..0dfa5c7fb 100644 --- a/magpierss/rss_parse.inc +++ b/magpierss/rss_parse.inc @@ -141,11 +141,18 @@ class MagpieRSS { 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, $output_encoding, $input_encoding, $detect_encoding); - $source = mb_convert_encoding($source, "UTF-8", - mb_detect_encoding($source)); + $source = mb_convert_encoding($source, "UTF-8", $enc); $this->parser = $parser; |