WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 19 months ago

#10713 new defect (bug)

Output encoding not set in fetch_feed

Reported by: iansealy Owned by:
Milestone: Future Release Priority: low
Severity: normal Version: 2.8.4
Component: Feeds Keywords: has-patch dev-feedback
Focuses: Cc:

Description

If using WP Super Cache (or a similar plugin) on a blog with a non-UTF-8 charset that has an RSS widget then the charset is incorrectly changed to UTF-8 by SimplePie.

The fix is to explictly set the encoding in fetch_feed before SimplePie sends any headers (which it only does if WP Super Cache is being used, since it checks if any headers have already been sent).

*** live/wp-includes/feed.php      2009-05-25 11:13:48.000000000 +0200
--- dev/wp-includes/feed.php       2009-09-01 17:40:19.000000000 +0200
***************
*** 552,557 ****
--- 552,558 ----
        $feed->set_file_class('WP_SimplePie_File');
        $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 43200));
        $feed->init();
+       $feed->set_output_encoding(get_option('blog_charset'));
        $feed->handle_content_type();
  
        if ( $feed->error() )

I've put this as low priority since I guess most blogs use UTF-8 and don't use WP Super Cache.

Attachments (3)

feed.php.diff (457 bytes) - added by iansealy 5 years ago.
10713.diff (513 bytes) - added by MikeHansenMe 19 months ago.
refreshed based on previous patch - relative to root and new lines changed
10713.2.diff (514 bytes) - added by SergeyBiryukov 19 months ago.
With proper formatting

Download all attachments as: .zip

Change History (7)

comment:1 scribu5 years ago

  • Cc scribu@… added
  • Component changed from Widgets to Feeds
  • Milestone changed from Unassigned to Future Release
  • Owner azaozz deleted

Instead of pasting the diff directly, please attach it as a file.

iansealy5 years ago

comment:2 iansealy5 years ago

  • Cc iansealy added

Sorry. Patch now attached as a file.

comment:3 dd325 years ago

  • Keywords has-patch dev-feedback added; SimplePie removed

MikeHansenMe19 months ago

refreshed based on previous patch - relative to root and new lines changed

comment:4 MikeHansenMe19 months ago

  • Cc mdhansen@… added

SergeyBiryukov19 months ago

With proper formatting

Note: See TracTickets for help on using tickets.