truncate_string() now actually is utf-8 compatible

This commit is contained in:
Andrew Dolgov 2005-12-31 06:38:40 +01:00
parent 7d8d10c6ed
commit 12db369ca7
1 changed files with 2 additions and 2 deletions

View File

@ -821,8 +821,8 @@
}
function truncate_string($str, $max_len) {
if (mb_strlen($str) > $max_len - 3) {
return mb_substr($str, 0, $max_len) . "...";
if (mb_strlen($str, "utf-8") > $max_len - 3) {
return mb_substr($str, 0, $max_len, "utf-8") . "...";
} else {
return $str;
}