Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] swish.cgi: Escaping special characters in $link_href

From: Bill Moseley <moseley(at)>
Date: Thu May 14 2009 - 16:51:18 GMT
On Thu, May 14, 2009 at 06:36:08PM +0200, wrote:
> In the meantime, I found a solution using the URI::Escape module (
> ) which does exactly
> what I need.

You are correct.  The advice I gave for the "html" filter in the
template was incorrect.  That simply escapes to the normal HTML entities.

Template toolkit has the "url" filter which escapes:

Without the url filter it passed through directly:

$ echo ' <a href="[% " Niņo" %]">El Niņo</a>' | tpage
 <a href=" Niņo">El Niņo</a>

With the "url" filter:

$ echo ' <a href="[% " Niņo" | url %]">El Niņo</a>' | tpage
 <a href="">El Niņo</a>

Don't get it confused with the "uri" filter which you would use for,
say, a query parameter not an entire url.

$ echo ' <a href="[% " Niņo" | uri %]">El Niņo</a>' | tpage
 <a href="">El Niņo</a>

Bill Moseley.
Sent from my iMutt
Users mailing list
Received on Thu May 14 12:51:16 2009