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

truncate string error?

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


Joined: 20 Mar 2009
Posts: 39

PostPosted: Wed Feb 29, 2012 5:55 pm    Post subject: truncate string error? Reply with quote

Dont know what's going on...
It's ok when dealing Chinese, but except these characters:

Alewijnse Marine Systems

I dont know why this string can not be truncated in:

{$node.content|stripslashes|truncate:80}

It would give me:

Alewijnse Marine...

Any idea?(it is really far away from 80 characters)
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 5:58 pm    Post subject: Reply with quote

Which version of Smarty are you using? Which charset / encoding are you working with?
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
yarco
Smarty Regular


Joined: 20 Mar 2009
Posts: 39

PostPosted: Thu Mar 01, 2012 4:15 am    Post subject: Reply with quote

rodneyrehm wrote:
Which version of Smarty are you using? Which charset / encoding are you working with?


==============
found in Smarty.class.php
* @version 3.1.7
* SVN: $Id: Smarty.class.php 4518 2011-12-18 18:48:07Z rodneyrehm $
==============
And the charset/encoding is UTF8.

Article is here: http://www.haibangindustrial.com/?a=news&id=1 (in Chinese)
List is here: http://www.haibangindustrial.com/?a=newslist (the first news)

And now i fixed it in php. When output a list, i did
mb_substr(striptags($content), 0, 80)

And in template:
{$content|stripslashes}...
(oh, seems i also need to do stripslashes in php first)

So never mind, now.
Back to top
View user's profile Send private message
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