use multibyte-aware mb_strlen() instead of strlen(); fixed issue #8)

This commit is contained in:
Savetheinternet
2011-12-07 17:47:36 +11:00
parent 825317ec38
commit 6a02dfd5aa
4 changed files with 21 additions and 15 deletions

View File

@@ -72,7 +72,7 @@ function twig_sprintf_filter( $value, $var) {
}
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') {
if (strlen($value) > $length) {
if (mb_strlen($value) > $length) {
if ($preserve) {
if (false !== ($breakpoint = strpos($value, ' ', $length))) {
$length = $breakpoint;

View File

@@ -7,7 +7,8 @@
require 'contrib/gettext/gettext.inc';
register_shutdown_function('fatal_error_handler');
register_shutdown_function('fatal_error_handler');
mb_internal_encoding('UTF-8');
loadConfig();
function loadConfig() {