From b63d94838da090cddb98f1b7f19268a32c6a75d8 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Fri, 18 Jan 2013 18:10:14 -0600 Subject: [PATCH] Do truncation by actual character count. Using substr can cut a multi-byte character in half. Also, if a long post with many multi-byte characters was reported, then the mod interface would temporarily extend the body_truncate_char setting to be sure to cover all of the *characters* in the report, but this function would interpret body_truncate_char as a number of *bytes*, so sometimes the end of the report's appended html would be cut off. --- inc/display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/display.php b/inc/display.php index f4e1151e..85c21e7c 100644 --- a/inc/display.php +++ b/inc/display.php @@ -170,7 +170,7 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { $body = $m[0]; } - $body = substr($body, 0, $max_chars); + $body = mb_substr($body, 0, $max_chars); if ($body != $original_body) { // Remove any corrupt tags at the end