Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#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>&lt;h1&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
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(‘/</’,’/>/’,”/’/”,’/”/’), array(‘&lt;’,’&gt;’,’&#039;’,’&quot;’),$Body);
// encode bare ampersands
$Body = preg_replace(“/&(?!1+;|\w+;)/i”,’&amp;’, $Body);
</pre>
I replaced them by this one:
<pre>
$Body = preg_replace(array(‘/&/’,’/</’,’/>/’,”/’/”,’/”/’), array(‘&amp;’,’&lt;’,’&gt;’,’&#039;’,’&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