Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-05-09 03:31:14

nesher
Archived Plugin Author
Registered: 2004-02-23
Posts: 15

[issue] Double-escaping tags for the RSS feed.

When I’m posting a code example in my texpattern blog, something really simple along the lines of <code><h1></code>, I run into trouble w/ my RSS feed.

Textpattern doesn’t double-escape the < and > characters for the RSS feed, so NetNewsWire and other newsreaders interpret the <code><h1></code> tag as a true <code><h1></code>, styling the rest of the entry as an h1.

Same thing happens when I go ahead and do the & lt; and & gt; around the h1 instead of < and > (spaces included to psych out textile).

What Textpattern needs to do to make it proper in the RSS feed is make it look like this: <code>&amp;lt;h1&amp;gt;</code>

Does anybody know how to deal w/ this?

Offline

#2 2006-05-17 02:20:17

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: [issue] Double-escaping tags for the RSS feed.

Bumping this topic.

Offline

#3 2006-06-26 19:41:05

Wladimir Palant
New Member
Registered: 2006-06-20
Posts: 2
Website

Re: [issue] Double-escaping tags for the RSS feed.

Yes, I had the same problem, escaping is broken for the RSS feed (it works fine for Atom however). I changed textpattern/publish/rss.php to fix this. These lines are responsible for escaping there:

<pre>
$Body = rss_safe_hed($Body);

$Body = preg_replace(array(‘/&lt;/’,’/&gt;/’,”/’/”,’/”/’), array(‘&amp;lt;’,’&amp;gt;’,’&amp;#039;’,’&amp;quot;’),$Body);
// encode bare ampersands
$Body = preg_replace(“/&(?!1+;|\w+;)/i”,’&amp;amp;’, $Body);
</pre>

I replaced them by this one:

<pre>
$Body = preg_replace(array(‘/&/’,’/&lt;/’,’/&gt;/’,”/’/”,’/”/’), array(‘&amp;amp;’,’&amp;lt;’,’&amp;gt;’,’&amp;#039;’,’&amp;quot;’),$Body);
</pre>

Unless I am really missing something this is what it should’ve been.

PS: Posting code in this forum is hard :-(

Offline

Board footer

Powered by FluxBB