r67644 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67643‎ | r67644 | r67645 >
Date:17:41, 8 June 2010
Author:liangent
Status:deferred
Tags:
Comment:
Avoid "\0" in sortkeys
Modified paths:
  • /trunk/extensions/CategoryMultisortChinese/CategoryMultisortChinese.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryMultisortChinese/CategoryMultisortChinese.hooks.php
@@ -112,10 +112,10 @@
113113 $result = '';
114114 foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
115115 # One UTF-8 character can have 4 bytes max.
116 - $c = str_pad( $ch, 4, "\0");
 116+ $c = str_pad( $ch, 4, '_');
117117 $chcp = utf8ToCodepoint( $ch );
118118 # One Mandarin entry can have 7 bytes max.
119 - $md = str_pad( array_key_exists( $chcp, $data->mandarin ) ? $data->mandarin[$chcp] : '', 7, "\0");
 119+ $md = str_pad( array_key_exists( $chcp, $data->mandarin ) ? $data->mandarin[$chcp] : '', 7, '_');
120120 $result .= $md . $c;
121121 }
122122 return $result;
@@ -125,7 +125,7 @@
126126 $result = '';
127127 foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
128128 # One UTF-8 character can have 4 bytes max.
129 - $c = str_pad( $ch, 4, "\0");
 129+ $c = str_pad( $ch, 4, '_');
130130 $chcp = utf8ToCodepoint( $ch );
131131 # One stroke entry always has 3 bytes.
132132 $s = $this->onCategoryMultisortSortkeys_getStroke( $data, $chcp );
@@ -138,7 +138,7 @@
139139 $result = '';
140140 foreach ( $this->onCategoryMultisortSortkeys_splitString( $str ) as $ch ) {
141141 # One UTF-8 character can have 4 bytes max.
142 - $c = str_pad( $ch, 4, "\0");
 142+ $c = str_pad( $ch, 4, '_');
143143 $chcp = utf8ToCodepoint( $ch );
144144 # One radical-stroke entry always has 3 (radical) + 3 (stroke) = 6 bytes.
145145 $r = $this->onCategoryMultisortSortkeys_getRadical( $data, $chcp );

Status & tagging log