Opened 17 years ago
Closed 16 years ago
#6607 closed defect (bug) (duplicate)
RSS widget doesn't correct the target encoding
Reported by: | guillep2k | Owned by: | guillep2k |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.5.1 |
Component: | General | Keywords: | has-patch tested |
Focuses: | Cc: |
Description
When your blog is iso-8859-1 and your RSS widget takes information from an UTF-8 blog, the characters in your page can become garbled. The reverse is also true (your blog is UTF-8 and the RSS'd blog is ISO-8859-1). Here's my proposal for wp-includes/rss.php (around line 62):
$this->parser = $parser; #MODIFICATIONS BEGIN switch( @strtoupper(get_option('blog_charset')) ) { case 'UTF-8': xml_parser_set_option( $this->parser, XML_OPTION_TARGET_ENCODING, 'UTF-8' ); break; case 'ISO-8859-1': xml_parser_set_option( $this->parser, XML_OPTION_TARGET_ENCODING, 'ISO-8859-1' ); break; } #MODIFICATIONS END # pass in parser, and a reference to this object # setup handlers # xml_set_object( $this->parser, $this ); xml_set_element_handler($this->parser,
This would handle only iso-8859-1 to utf-8 and vice-versa, but most western blogs use one of these two encodings. Handling a percentage of the cases is better than none at all, I think. :)
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Added a patch for the proposed change.