2004.02.23

I recently did some work on a site that runs on a Windows server (gasp!) using IIS (yikes!) and ASP (eek!) If you know me, you know these are not my favored technologies. Nonetheless, we had a job to do.

The job was to add syndication feeds. We first added an RSS feed. Why did we choose to add an RSS feed first instead of an Atom feed? Well, not being familiar enough with ASP, we were not easily able to properly encode everything, In some cases data coming from SQL might need to be encoded, and our code didn’t always do the right thing. So we were faced with creating an RSS file that was occasionally invalid. We did not like this, but didn’t have another solution. We also knew that most of the RSS aggregators out there don’t mind invalid XML when it’s in the form of RSS. Still, while we were not pleased with the situation, we compromised.

At this point there was still not an Atom feed. We just couldn’t allow ourselves to bring an occasionally-invalid Atom feed to life, not until we discovered Server.HTMLEncode, which took care of the nasty characters that needed encoding. Once we had this final piece in place, we felt that it was OK to implement an Atom feed, and figured it would be valid (fingers were crossed of course.)

But wait, this wasn’t the final piece. There was one more, the dates and times… See, as an old Perl hacker, we’re used to using strftime to make any date/time we need. Since I couldn’t find a strftime function in ASP, I looked to the web and found A Customizable Date Formatting Routine which is close to strftime, well, close enough for my needs, but had some bugs. Anyway, we grabbed it, and it worked. More or less. (Ken Schaefer has pointed me to an update, though I still have to drop it in place.)

Where were we? Ah yes, the dates and times. Well, at first we just fudged the GMT which created valid feeds, but was lame. A little change in SQL eventually fixed that. Of course Atom requires a modified time, and it looks like it requires a created time, but if the created time is missing it should be considered the same as the modified time, and then there’s the time an item was issued as well, which is not required. I think.

Anyway, I’m pretty sure we’ve got it figured out now. The feeds both validate. Hopefully that will remain true. I think the dates and times even make sense now.

Comments are closed.

« | »


buy the button:

Buy The Button