Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

escape doesn't work very well for Smarty3Dev

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
g00fy
Smarty Rookie


Joined: 07 Dec 2005
Posts: 19

PostPosted: Mon Jun 07, 2010 9:29 am    Post subject: escape doesn't work very well for Smarty3Dev Reply with quote

I took an example from the Smarty2 help pages:

Code:
{assign var="articleTitle" value="'Wij geloven dat Vlaanderen sterker zal worden & dat België zal uitdoven.'"}
{* {assign var="articleTitle" value="'Stiff Opposition Expected to Casketless Funeral Plan'"} *}
{assign var="EmailAddress" value="smarty@example.com"}

{$articleTitle}
'Stiff Opposition Expected to Casketless Funeral Plan'

{$articleTitle|escape}
'Stiff Opposition Expected to Casketless Funeral Plan'

{$articleTitle|escape:"html"}    {* escapes  & " ' < > *}
'Stiff Opposition Expected to Casketless Funeral Plan'

{$articleTitle|escape:'htmlall'} {* escapes ALL html entities *}
'Stiff Opposition Expected to Casketless Funeral Plan'

<a href="?title={$articleTitle|escape:'url'}">click here</a>
<a href="?title=%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27">click here</a>

{$articleTitle|escape:'quotes'}
\'Stiff Opposition Expected to Casketless Funeral Plan\'

<a href="mailto:{$EmailAddress|escape:"hex"}">{$EmailAddress|escape:"hexentity"}</a>
<a href="mailto:%62%6f%..snip..%65%74">&#x62;&#x6f;&#x62..snip..&#x65;&#x74;</a>

{$EmailAddress|escape:'mail'}
smarty [AT] example [DOT] com

{* email address mangled *}
<a href="mailto:{$EmailAddress|escape:'hex'}">{$EmailAddress|escape:'mail'}</a>


The escape, escape-html and escape-htmlall doesn't seem to work anymore?

This results in:
Code:


'Wij geloven dat Vlaanderen sterker zal worden & dat België zal uitdoven.'
'Stiff Opposition Expected to Casketless Funeral Plan'


'Stiff Opposition Expected to Casketless Funeral Plan'

   
'Stiff Opposition Expected to Casketless Funeral Plan'

 
'Stiff Opposition Expected to Casketless Funeral Plan'

<a href="?title=%27Wij%20geloven%20dat%20Vlaanderen%20sterker%20zal%20worden%20%26%20dat%20Belgi%EB%20zal%20uitdoven.%27">click here</a>
<a href="?title=%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27">click here</a>

\'Wij geloven dat Vlaanderen sterker zal worden & dat België zal uitdoven.\'
\'Stiff Opposition Expected to Casketless Funeral Plan\'

<a href="mailto:%73%6d%61%72%74%79%40%65%78%61%6d%70%6c%65%2e%63%6f%6d">&#x73;&#x6d;&#x61;&#x72;&#x74;&#x79;&#x40;&#x65;&#x78;&#x61;&#x6d;&#x70;&#x6c;&#x65;&#x2e;&#x63;&#x6f;&#x6d;</a>
<a href="mailto:%62%6f%..snip..%65%74">&#x62;&#x6f;&#x62..snip..&#x65;&#x74;</a>

smarty [AT] example [DOT] com
smarty [AT] example [DOT] com


<a href="mailto:%73%6d%61%72%74%79%40%65%78%61%6d%70%6c%65%2e%63%6f%6d">smarty [AT] example [DOT] com</a>


But with the default sample it does work fine!
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Jun 07, 2010 1:34 pm    Post subject: Reply with quote

what isn't working? what were you expecting?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP