summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacil Tech <maciltech@gmail.com>2013-01-18 18:10:14 -0600
committerMacil Tech <maciltech@gmail.com>2013-01-18 18:26:25 -0600
commitb63d94838da090cddb98f1b7f19268a32c6a75d8 (patch)
tree70989c2cf770cde5f1cea7ec2b642ee97a683342
parent948dfe8555e06b2f900a92678faff918c2ab95b6 (diff)
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.
-rw-r--r--inc/display.php2
1 files changed, 1 insertions, 1 deletions
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