I have nasty issue occuring every so often where sometime a guest blogger would inadvertently put a non-UTF character or an unbalanced HTML tag into a post, which will then break the RSS feed and will result in FeedBurner not being able to send it to subscribers via email.

Is there a technological way to avoid this kind of issues?


2 Answers 2


copy this code in a php file, copy this file in your plugins-folder and after this activate it on the backend of WordPress. I hope this helps, but i dont test it, write it on scratch.

 * Plugin Name: Non-UTF characters in RSS feed
 * Plugin URI:  http://wordpress.stackexchange.com/questions/37845/non-utf-characters-break-rss-feed/
 * Description: Filter content for unicode characters
 * Version:  1.0.0
 * Author:      Frank Bültge
 * Author URI:  http://bueltge.de
 * License:     GPLv3

// This file is not called from WordPress. We don't like that.
! defined( 'ABSPATH' ) and exit;

foreach ( array( 'the_content_rss', 'the_excerpt_rss', 'the_title_rss', 'comment_text_rss' ) as $filter )
    remove_filter( $filter, 'filter_non_utf8_chars', 0 );

function filter_non_utf8_chars( $content ) {

    return htmlentities2( $content );

If this is just happening in the RSS content area, try filtering out the chars by using the_content_rss filter:

add_filter('the_content_rss', 'filter_non_utf8_chars', 0, 1);
function filter_non_utf8_chars($content){
    $content = preg_replace('/[^(\x20-\x7F)\x0A]*/','', $content);
    return $content;

Here are the filters related to RSS feeds:

  1. the_excerpt_rss
  2. the_content_rss
  3. the_title_rss
  4. comment_text_rss

Hope this helps!

  • 2
    i think its better you use an WP Core function, like htmlentities2 as an preg_replace; its isier to maintenance and work.
    – bueltge
    Commented Feb 6, 2012 at 10:09
  • Frank @bueltge - Why not post it as an answer?
    – kaiser
    Commented Feb 10, 2012 at 18:51
  • This works, but it strips all kind of valid utf8 chars. Use stackoverflow.com/a/1401716 this regex instead.
    – Epskampie
    Commented Feb 23, 2022 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.