Du kan bruge mb_strimwidth (PHP-dokumentation):
echo mb_strimwidth("Hello World", 0, 10, "...");
Eller en brugerdefineret funktion som Multibyte String Truncate for Smarty :
mb_truncate($string, $length = 80, $etc = '...', $charset='UTF-8',
$break_words = false, $middle = false)
{
if ($length == 0)
return '';
if (strlen($string) > $length) {
$length -= min($length, strlen($etc));
if (!$break_words && !$middle) {
$string = preg_replace('/\s+?(\S+)?$/', '', mb_substr($string, 0, $length+1, $charset));
}
if(!$middle) {
return mb_substr($string, 0, $length, $charset) . $etc;
} else {
return mb_substr($string, 0, $length/2, $charset) . $etc . mb_substr($string, -$length/2, $charset);
}
} else {
return $string;
}
}