Syndicate content

Broken RSS feeds

Since December 2008, I have noticed that many RSS feeds include invalid ampersand characters. XML has a very specific way to handle the ampersand character, you have to write & and not just &. Although it is similar in HTML, in XML it is actually enforced.

This is neat, it ensures that your files are really valid.

Now, when you do enforce the syntax, you also very simply lose the capability of reading many RSS feeds even from quite prominent websites such as the National Geographic RSS feed (yes, they do not know how to handle the ampersand properly, at least they have been so far and we're in Jul 23, 2009.)

Why is that? you will ask... Well, the fact is that most of the best readers work properly. Those are Outlook, FireFox, Opera and a few others. What those readers do is interpret the lone ampersand characters as ampersand characters and don't bother generating an error.

The problem for me is that Drupal, and the aggregator author, does not want to fix those invalid ampersands (at least not in the core) and thus I cannot read my favorite RSS feed... Can't I? Oh! Sorry! I'm a programmer. So I can actually fix the feed myself and forget about Drupal Core author not willing to fix their program. This is so cool. I have the power!!!

But of course, some others may want to benefit from the patch I wrote. It is available on the Drupal website, there is a copy of the D6 and D7 patches.

First, give a try to this really bad feed:

And the funny thing is, FireFox and Thunderbird cannot read that really bad feed, but my code can. The main reason why is because of a double ampersand (as in C/C++ or PHP code such as: a&&b).

Once you tested my broken feed with your existing Drupal site, then use my patches to fix your code, finally try again and will see the content of the feed. Cool hey?!


aggregator-fix_ampersand-6.x.patch1.64 KB
aggregator-fix_ampersand-7.x.patch2.06 KB
Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165


Terms of Site Index

Find the page/content you are looking for with our index.

  • collection
  • decimal

    Most Database systems offer a number type called DECIMAL. In general, it represents a fixed integer number with a set number of digits on the left side of the decimal point and a set of digits after the decimal point. Some database system will use floating points instead. Commonly used synonyms are MONEY and CURRENCY.

  • shift
  • table
  • vsftpd

    Very Secure File Transfer Protocol Daemon, an FTP server that allows people to transfer data between computers. It is marked as very secure, at least it is as secure as an FTP server can be (although there has been several security advisories for this tool...)

    Remember that an FTP transfer is rarely using an encrypted pipe (it is possible to use kerberos and SSL to really secure the data transmission) and also because it uses a data stream opened dynamically, it is possible for hackers to spoof a data connection.