From: Andrew Dolgov Date: Sat, 31 Dec 2005 05:38:40 +0000 (+0100) Subject: truncate_string() now actually is utf-8 compatible X-Git-Tag: schema_freeze_for_1.1.2~20 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=12db369ca71f3ba1cfadd8890ebcb203927083f6;p=tt-rss.git truncate_string() now actually is utf-8 compatible --- diff --git a/functions.php b/functions.php index f40ce761..7d65c903 100644 --- a/functions.php +++ b/functions.php @@ -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; }