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: http://linux.m2osw.com/broken-feed.php

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?!

Enjoy!

AttachmentSize
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
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

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

  • HTTPS

    Hyper Text Transfer Protocol Secure—The protocol used by browsers to communicate to web servers securely. The security is done with similarly to SSH. The transfer uses FTP like commands, but only one connection. Since HTTP 1.1 it is also possible to reuse the same connection for multiple files (pages, images, videos, etc.)

  • Ibex
  • associate
  • combo
  • domain