diff options
Diffstat (limited to 'system/helpers/text_helper.php')
-rw-r--r-- | system/helpers/text_helper.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index b2351db95..4ddf648cb 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -85,7 +85,7 @@ if ( ! function_exists('character_limiter')) */ function character_limiter($str, $n = 500, $end_char = '…') { - if (strlen($str) < $n) + if (strlen(utf8_decode($str)) < $n) { return $str; } @@ -93,7 +93,7 @@ if ( ! function_exists('character_limiter')) // a bit complicated, but faster than preg_replace with \s+ $str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\x0B", "\x0C"), ' ', $str)); - if (strlen($str) <= $n) + if (strlen(utf8_decode($str)) <= $n) { return $str; } @@ -103,10 +103,10 @@ if ( ! function_exists('character_limiter')) { $out .= $val.' '; - if (strlen($out) >= $n) + if (strlen(utf8_decode($out)) >= $n) { $out = trim($out); - return (strlen($out) === strlen($str)) ? $out : $out.$end_char; + return (strlen(utf8_decode($out)) === strlen(utf8_decode($str))) ? $out : $out.$end_char; } } } @@ -537,4 +537,4 @@ if ( ! function_exists('ellipsize')) } /* End of file text_helper.php */ -/* Location: ./system/helpers/text_helper.php */
\ No newline at end of file +/* Location: ./system/helpers/text_helper.php */ |