Swedish letters in RSS feed public template



It seems that the public template RssFeed that comes with R2 does not support swedish letters å ä ö when viewed through for instance Google Reader. The template renders an RSS tag (rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0") instead of the former version of this template approarch, an XML tag (?xml version="1.0" encoding="UTF-8"?)

I have set an encoding attribute with value UTF-8 to the rss tag like the xml tag, but it has no effect. Does any RSS/XML-savvy person know the correct approach to this? Or do I have to revert to the original template?


Feb 24, 2009 10:52

Got the answer, posting it here for future reference. Add the following before declaring the versionInfo attribute:

XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.InsertBefore(decl, outerNode);


Mar 04, 2009 11:11

You may also want to set

Response.ContentType = "text/xml"; // "application/rss+xml" is an alternative
Response.Encoding = "UTF-8";

to make some picky readers happy and to validate in feedvalidator.org

Edited, Mar 05, 2009 13:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.