Allow Chinese/Japanese UTF-8 strings to be truncated at character
boundaries instead of word boundaries. (fix MDL-5378)
This commit is contained in:
@@ -5608,6 +5608,9 @@ function shorten_text($text, $ideal=30) {
|
||||
if ($char == '.' or $char == ' ') {
|
||||
$truncate = $i+1;
|
||||
break 2;
|
||||
} else if (ord($char) >= 0xE0) {
|
||||
$truncate = $i;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
|
||||
Reference in New Issue
Block a user