Browse Source

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.
pull/40/head
Macil Tech 11 years ago
parent
commit
b63d94838d
  1. 2
      inc/display.php

2
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

Loading…
Cancel
Save