Details
Description
function shorten_text creates very long lines in Japanese (unicode), probably because there are no latin style spaces or periods. $stopzone is looking for space or periods to determin where to truncate the text, but there are none, so it ends up including the entire original text.
The extremely long lines creates a rather serious interface problem in the assignment module. (online assignments; online/assignments.class.php)
http://moodle.cvs.sourceforge.net/moodle/moodle/lib/moodlelib.php
line 5430
From Paul Shew (thetrinity at shew.jp) Friday, 30 September 2005, 04:32 PM:
I made a temporary, rough fix for my site (which is all Japanese) by changing the last line of the function as follows.
Here's the original return line:
return substr($text, 0, $truncate).$ellipse;
Here's my greatly simplified solution with a unicode-safe cutoff at the ideal point.
return mb_substr($text, 0, $ideal).$ellipse;
Of course, this renders the function useless for its original intention, but for other sites in languages like Japanese, it is a quick fix.
From Paul Shew (thetrinity at shew.jp) Saturday, 1 October 2005, 10:09 AM:
Haruhiko Okumura in the Japanese forum, suggests this solution:
I couldn't reproduce the bug so I'm not sure if this helps; my idea is to change
if ($char == '.' or $char == ' ')
to
if ($char == '.' or $char == ' ' or $char >= 0x80)
and
substr($text, 0, $truncate)
to
mb_strcut($text, 0, $truncate, get_string(thischarset))