WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 3 years ago

#10713 closed defect (bug) (fixed)

Output encoding not set in fetch_feed

Reported by: iansealy Owned by: chriscct7
Milestone: 4.3 Priority: normal
Severity: normal Version: 2.8.4
Component: Feeds Keywords: has-patch commit
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 (4)

feed.php.diff (457 bytes) - added by iansealy 9 years ago.
10713.diff (513 bytes) - added by MikeHansenMe 6 years ago.
refreshed based on previous patch - relative to root and new lines changed
10713.2.diff (514 bytes) - added by SergeyBiryukov 6 years ago.
With proper formatting
10713.3.patch (414 bytes) - added by chriscct7 3 years ago.
Refresh

Download all attachments as: .zip

Change History (12)

#1 @scribu
9 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.

@iansealy
9 years ago

#2 @iansealy
9 years ago

  • Cc iansealy added

Sorry. Patch now attached as a file.

#3 @dd32
9 years ago

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

@MikeHansenMe
6 years ago

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

#4 @MikeHansenMe
6 years ago

  • Cc mdhansen@… added

@SergeyBiryukov
6 years ago

With proper formatting

@chriscct7
3 years ago

Refresh

#5 @chriscct7
3 years ago

  • Keywords dev-feedback removed

Looks good. Refreshed the patch. Ready to go.

#6 @SergeyBiryukov
3 years ago

  • Milestone changed from Future Release to 4.3

#7 @chriscct7
3 years ago

  • Keywords commit added
  • Owner set to chriscct7
  • Priority changed from low to normal
  • Status changed from new to accepted

#8 @wonderboymusic
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 32469:

In fetch_feed(), call ->set_output_encoding() on the SimplePie instance to ensure the feed is served with encoding specified by the blog_charset option.

Props chriscct7.
Fixes #10713.

Note: See TracTickets for help on using tickets.