Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Strip filter is broken

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
Tradlost
Smarty n00b


Joined: 29 Feb 2012
Posts: 3

PostPosted: Wed Feb 29, 2012 9:09 am    Post subject: Strip filter is broken Reply with quote

The strip filter is not working if you use ISO8859-1 as charset and scecial chars are introduced.

*{'Kotlett rad& '|strip:'#'}* outputs *Kotlett#rad&#*

*{'Kötlett rad& '|strip:'#'}* outputs **

Even though ISO8859-1 is less common, it's still out there. I've started the plan for moving to UTF8 but upgrading to Smarty3 is my first priority. I really don't know if changing charset will even help.

So, is there a workaround?
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Feb 29, 2012 9:18 am    Post subject: Reply with quote

Have you told smarty to use ISO8859-1?
Code:
define('SMARTY_RESOURCE_CHAR_SET', 'ISO-8859-1');
include '…/Smarty.class.php';

_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Tradlost
Smarty n00b


Joined: 29 Feb 2012
Posts: 3

PostPosted: Wed Feb 29, 2012 10:12 am    Post subject: Reply with quote

Now I have but it won't help. It compiles to the same two lines.

Code:
*<?php echo preg_replace('!\s+!u', '#','Kotlett rad& ');?>*

*<?php echo preg_replace('!\s+!u', '#','Kötlett rad& ');?>*

I did a test saving the source as UTF8 and it works fine. *Kötlett#rad&#*

I even tried the mb_internal_encoding('ISO-8859-1'); with no luck.

The only way to do it quick is to remove the u modifier in modifiercompiler.strip.php. Is it really necessary with the u in this function?
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Feb 29, 2012 10:15 am    Post subject: Reply with quote

Please upgrade to a newer Smarty version. the u-modifier problem had been resolved in 3.1.7 I think - 3.1.8 is the current stable!
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Tradlost
Smarty n00b


Joined: 29 Feb 2012
Posts: 3

PostPosted: Wed Feb 29, 2012 11:08 am    Post subject: Reply with quote

Upgraded to current and got a lot of errors.
Code:

Notice: Undefined property: Templater::$secure_dir in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 693
Notice: Undefined property: Templater::$webmaster_mode in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 667
Notice: Undefined property: Templater::$webmaster_mode in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 667
Notice: Undefined property: Templater::$webmaster_mode in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 667
Notice: Undefined property: Templater::$_tpl_vars in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 667
Notice: Undefined property: Templater::$template_resource in /var/www/include/Smarty-3.1.8/libs/Smarty.class.php on line 693


I guess I have to write new functions for __get and __set to allow reading of these values in my extension.
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Wed Feb 29, 2012 11:21 am    Post subject: Reply with quote

I don't know which version you've been using before the upgrade.
The attribute webmaster_mode seems to be unrelated to smarty. secure_dir is an attribute of Smarty_Security, not Smarty. template_resource is an attribute of Smarty_Internal_Template, not Smarty. _tpl_vars doesn't exist anymore - tpl_vars is the current container. You shouldn't be accessing this, though.
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 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