diff --git a/includes/common.inc b/includes/common.inc index 020d0c5d8e478c7ebc67350bf7bf53344ac9348c..6f4353e299c3f507015a40f83969d573c9d4d3eb 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1831,7 +1831,7 @@ function drupal_convert_to_utf8($data, $encoding) { * @return * The truncated string. */ -function truncate_utf8($string, $len, $wordsafe = FALSE) { +function truncate_utf8($string, $len, $wordsafe = FALSE, $dots = FALSE) { $slen = strlen($string); if ($slen <= $len) { return $string; @@ -1840,10 +1840,10 @@ function truncate_utf8($string, $len, $wordsafe = FALSE) { while (($string[--$len] != ' ') && ($len > 0)) {}; } if ((ord($string[$len]) < 0x80) || (ord($string[$len]) >= 0xC0)) { - return substr($string, 0, $len); + return substr($string, 0, $len) . ($dots ? ' ...' : ''); } while (ord($string[--$len]) < 0xC0) {}; - return substr($string, 0, $len); + return substr($string, 0, $len) . ($dots ? ' ...' : ''); } /**