Swedish letters in RSS feed public template

Mårten Berg
Member since: 2004
 

Hello,

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?

Regards,
/Marten

#28187 Feb 24, 2009 10:52
  • Mårten Berg
    Member since: 2004
     

    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);

     

    #28351 Mar 04, 2009 11:11
  • Magnus Rahl
    Member since: 2008
     

    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

    #28362 Edited, Mar 05, 2009 13:14