From 6857bb3df6841f8b85e3ead901bbb70c745b48c3 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Wed, 24 Aug 2011 23:47:54 +0000 Subject: [PATCH] (bug 28649) use $wgContLang->truncate on log action comments to avoid half eaten unicode chars and also adds a nice '...' Patch by Umherirrender. --- RELEASE-NOTES-1.19 | 2 ++ includes/LogPage.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 87e66c19fb..a7ce798a2f 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -70,6 +70,8 @@ production. warnings/notices to be thrown. * (bug 30335) Fix for HTMLForms using GET breaking when non-friendly URLs are used +* (bug 28649) Avoiding half truncated multi-byte unicode characters when + truncating log comments. === API changes in 1.19 === * (bug 19838) siprop=interwikimap can now use the interwiki cache. diff --git a/includes/LogPage.php b/includes/LogPage.php index 5155d9a5c0..c810b24d13 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -416,6 +416,8 @@ class LogPage { * @param $doer User object: the user doing the action */ public function addEntry( $action, $target, $comment, $params = array(), $doer = null ) { + global $wgContLang; + if ( !is_array( $params ) ) { $params = array( $params ); } @@ -424,6 +426,9 @@ class LogPage { $comment = ''; } + # Truncate for whole multibyte characters. + $comment = $wgContLang->truncate( $comment, 255 ); + $this->action = $action; $this->target = $target; $this->comment = $comment; -- 2.20.1