The RSS Blog

News and commentary from the RSS and OPML community.

Big in the blogosphere this week is an attempt to have feed publishers respect RFC 3023. Even the FeedValidator itself is being changed to warn users of pending doom, if they don't fixup those HTTP headers. And I think we've matured enough that we can expand the meaning of a valid RSS feed. So, here's my contribution to this adventure in RFC 3023-land.

Here's an ASPX file that examines an XML file's declaration and tries to fixup the content charset.

<%@ Page language="c#" %>
<%
string uri = Request.Params["xml"];
if (uri == null || uri == string.Empty)
{
   return;
}

if (!uri.StartsWith("http://") && !uri.StartsWith("https://"))
{
   uri = Server.MapPath(uri);
}

System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(uri);
Response.ContentType = "text/xml";
if (doc.FirstChild.NodeType == System.Xml.XmlNodeType.XmlDeclaration)
{
   System.Xml.XmlDeclaration decl = (System.Xml.XmlDeclaration)doc.FirstChild;
   Response.Charset = decl.Encoding;
}
doc.Save(Response.OutputStream);
%>

Here's my RSS feed before and after the transformation. Here's what the Feed Validator thinks of my RSS feed before and after the transformation.

Here are the HTTP headers before...

HTTP/1.1 200 OK
Content-Length: 37579
Content-Type: text/xml
Last-Modified: Thu, 08 Jul 2004 19:02:04 GMT
Accept-Ranges: bytes
ETag: "d1a0c7e1e65c41:1bf6a"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Thu, 08 Jul 2004 20:34:05 GMT

...and after the tranformation.

HTTP/1.1 200 OK
Date: Thu, 08 Jul 2004 20:34:48 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 37579

I'll have to fixup the caching.

Thanks to Sam and Joe for beefing up the FeedValidator. And Asbjorn for helping me test this stuff.

Reader Comments Subscribe
Great Deals On Mattresses and Furniture check out the surrounding areas for Phoenix Furniture.
It was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity!
I wanted to drop you a quick note to express my thanks as I have enjoyed the way you've structured your site which is very nice one and gives in depth information. I think it will be helpful for me as well
The perfect place for my needs, Contains wonderful and useful messages, I have read most of them and has a lot of them
Can you please put up more info on this case?? Besides your blog is first-class. Truly!!

Type "339":