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

truncate string error?

 
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 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:   
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 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