Fix HTML character entities in RSS/Atom feeds (2 posts)

  1. cavlec
    Posted 12 years ago #

    Also posted to my blog...
    A mild gotcha that the WordPress folks (users and coders alike) might want to take notice of:
    My RSS and Atom feeds are currently invalid because I inserted HTML character entities (specifically ô and ñ) into my posts, rather than using the numerical Unicode equivalents or inserting the characters directly.
    The fix, if you choose to code it, is to do a quick search-and-replace sweep for those entities when outputting any sort of XML other than XHTML. The fix, if you choose to author it, is not to be lazy like I am—look up the numbers and use ’em.

  2. carthik
    Posted 12 years ago #

    WordPress makes use of CDATA ( http://www.w3schools.com/xml/xml_cdata.asp ) for the content of the post :
    <![CDATA[<?php the_content('', 0, '') ?>]]>
    which allows one to put un-escaped characters in xml.
    However, I think it might be the excerpt that may be causing the mentioned problem.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.