]> git.mjollnir.org Git - moodle.git/commitdiff
Allow Chinese/Japanese UTF-8 strings to be truncated at character
authormartinlanghoff <martinlanghoff>
Thu, 28 Sep 2006 00:10:23 +0000 (00:10 +0000)
committermartinlanghoff <martinlanghoff>
Thu, 28 Sep 2006 00:10:23 +0000 (00:10 +0000)
boundaries instead of word boundaries. (fix MDL-5378)

lib/moodlelib.php

index a6b1d975c7f00bf93b42cc274555e8a442f8f4c9..218e6de3f8be295d3badf5a12ce0e91d6d6376c8 100644 (file)
@@ -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++;