Ticket #6607 (assigned defect (bug))

Opened 9 months ago

Last modified 6 months ago

RSS widget doesn't correct the target encoding

Reported by: guillep2k Assigned to: guillep2k (accepted)
Priority: normal Milestone: 2.9
Component: General Version: 2.5.1
Severity: normal Keywords: has-patch tested
Cc: guillep2k

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

6607.diff (0.6 kB) - added by guillep2k on 05/01/08 22:34:36.

Change History

05/01/08 22:34:36 changed by guillep2k

  • attachment 6607.diff added.

05/01/08 22:35:50 changed by guillep2k

  • keywords set to has-patch.
  • version changed from 2.6 to 2.5.1.
  • milestone changed from 2.7 to 2.5.2.

Added a patch for the proposed change.

05/01/08 22:43:03 changed by guillep2k

  • owner changed from anonymous to guillep2k.
  • status changed from new to assigned.

05/01/08 22:46:05 changed by guillep2k

  • keywords changed from has-patch to has-patch tested.

I tested the patch with 2.5.1, using a blog set up to ISO-8859-1 and taking an RSS from an UTF-8 blog.

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted