http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95456

Revision: 95456
Author:   bawolff
Date:     2011-08-24 23:47:54 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
(bug 28649) use $wgContLang->truncate on log action comments to avoid half 
eaten unicode chars and also adds a nice '...'

Patch by Umherirrender.

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.19
    trunk/phase3/includes/LogPage.php

Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19     2011-08-24 22:52:34 UTC (rev 95455)
+++ trunk/phase3/RELEASE-NOTES-1.19     2011-08-24 23:47:54 UTC (rev 95456)
@@ -70,6 +70,8 @@
   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.

Modified: trunk/phase3/includes/LogPage.php
===================================================================
--- trunk/phase3/includes/LogPage.php   2011-08-24 22:52:34 UTC (rev 95455)
+++ trunk/phase3/includes/LogPage.php   2011-08-24 23:47:54 UTC (rev 95456)
@@ -416,6 +416,8 @@
         * @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 @@
                        $comment = '';
                }
 
+               # Truncate for whole multibyte characters.
+               $comment = $wgContLang->truncate( $comment, 255 );
+
                $this->action = $action;
                $this->target = $target;
                $this->comment = $comment;


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to