WordPress.org

Ready to get started?Download WordPress

Forums

Charset Problems in RSS feed (5 posts)

  1. jrothra
    Member
    Posted 8 years ago #

    I've got WP 2.0 and it's set to run feeds as UTF-8. My website is also set to UTF-8. Yet, whenever my website pulls the WP feed from the wp-rss2.php feed URL, the following characters have issues:

    apostrophe/single quote (')
    double quote (")

    Each of these shows up as a question mark (?) on my site. You can see an example on my test page: http://www.jrothraministries.com/index2.php -- look under the Latest Blog section... the ? in the title should be a single quote '

  2. jrothra
    Member
    Posted 8 years ago #

    One more bit of info... the character problem only happens in the title, not in the body, of the post... and it only happens on the website (not the actual blog). It's strange that way.

  3. Kafkaesqui

    Posted 8 years ago #

    This is not an issue with the character set. Rather it's a combination of problems: the RSS2 format and the ability of aggregation tools to read "advanced" HTML character entities (i.e. “ for “ and ” for ”), and WordPress' desire to convert nearly everything (which is usually a good thing, just not in this case).

    There are a few ways you can fix this:

    1. Edit your wp-rss2.php file. Just change the <title> element for the post title from this:

    <title><?php the_title_rss() ?></title>

    to this:

    <title><![CDATA[<?php the_title_rss() ?>]]></title>

    2. In template-functions-post.php (wp-includes/ directory) locate the_title_rss() function, and specifically this line in it:

    $title = apply_filters('the_title', $title);

    Just comment it out:

    // $title = apply_filters('the_title', $title);

    For both, be aware of the source hacker's warnings: back up any files before editing them, and comment your changes for future reference.

  4. jrothra
    Member
    Posted 8 years ago #

    Thank you, Kafkaesqui! Your help resolved the problem. May you be blessed in all you do.

  5. condi4prez
    Member
    Posted 7 years ago #

    Has this been "fixed" in 2.04? The file template-functions-post.php no longer has the statement:

    $title = apply_filters('the_title', $title);

    Now, it has the statement as part of a function as follows:

    function the_title($before = '', $after = '', $echo = true) {
    $title = get_the_title();
    if ( strlen($title) > 0 ) {
    $title = apply_filters('the_title', $before . $title . $after, $before, $after);
    if ( $echo )
    echo $title;
    else
    return $title;
    }
    }

    I went ahead and made the change to the wp-rss2.php file since I was still noticing problems with the apostrophe, double dash, and quotation marks. I'll see if the single change clears it up. If not, I'll experiment with commenting out the apply filters statement.

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic