Hi Monks,

I've recently been moved to a new hosting environment I don't have much control of. Previously I had an rss feed generated by XML::RSS 1.05 my new environment has XML::RSS 1.48 which has resulted in problems with my rss feed.

A minimal test case follows:

use XML::RSS; my $rss = new XML::RSS (version => '1.0', encoding => "UTF-8"); $rss->channel(title => "Test", link => "http://example.com", description => "Test script", ); $rss->add_item(title => "Test", link => "http://example.com/2", description => "<i>Some HTML</i> Some text", ); $rss->{output} = '1.0'; print $rss->as_string;
1.05 results as desired
<?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" > <channel rdf:about="http://example.com"> <title>Test</title> <link>http://example.com</link> <description>Test script</description> <items> <rdf:Seq> <rdf:li rdf:resource="http://example.com/2" /> </rdf:Seq> </items> </channel> <item rdf:about="http://example.com/2"> <title>Test</title> <link>http://example.com/2</link> <description>&lt;i>Some HTML&lt;/i> Some text</description> </item> </rdf:RDF>
1.48 results with undesired encoding
<code> <?xml version="1.0" encoding="UTF-8"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" > <channel rdf:about="http://example.com"> <title>Test</title> <link>http://example.com</link> <description>Test script</description> <items> <rdf:Seq> <rdf:li rdf:resource="http://example.com/2" /> </rdf:Seq> </items> </channel> <item rdf:about="http://example.com/2"> <title>Test</title> <link>http://example.com/2</link> <description>&#x3C;i&#x3E;Some HTML&#x3C;/i&#x3E; Some text</descripti +on> </item> </rdf:RDF>

The key difference in the feed is the HTML portion:

<description>&lt;i>Some HTML&lt;/i> Some text</description> vs <description>&#x3C;i&#x3E;Some HTML&#x3C;/i&#x3E; Some text</descripti +on>
Any help getting the 1.48 version to work as intended would be much appreciated, I'm having a difficult time figuring out what option I may need to switch to get it to output as intended.
Thanks much,
camelreader

In reply to Problems with HTML Encoding in RSS after moving to XML::RSS 1.48 by camelreader

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.