r69333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69332‎ | r69333 | r69334 >
Date:17:34, 14 July 2010
Author:mah
Status:ok (Comments)
Tags:
Comment:
* revert r61258
* check if iconv extension is loaded and, if so, use it in UtfNormal::cleanUp()
Modified paths:
  • /trunk/phase3/includes/DjVuImage.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -72,6 +72,13 @@
7373 * @return string a clean, shiny, normalized UTF-8 string
7474 */
7575 static function cleanUp( $string ) {
 76+ if( extension_loaded( 'iconv' ) ) {
 77+ wfSuppressWarnings();
 78+ $ret = iconv( "UTF-8","UTF-8//IGNORE", $string );
 79+ wfRestoreWarnings();
 80+ return $ret;
 81+ }
 82+
7683 if( NORMALIZE_ICU ) {
7784 # We exclude a few chars that ICU would not.
7885 $string = preg_replace(
Index: trunk/phase3/includes/DjVuImage.php
@@ -251,13 +251,7 @@
252252 wfProfileOut( 'djvutxt' );
253253 if( $retval == 0) {
254254 # Get rid of invalid UTF-8, strip control characters
255 - if( is_callable( 'iconv' ) ) {
256 - wfSuppressWarnings();
257 - $txt = iconv( "UTF-8","UTF-8//IGNORE", $txt );
258 - wfRestoreWarnings();
259 - } else {
260 - $txt = UtfNormal::cleanUp( $txt );
261 - }
 255+ $txt = UtfNormal::cleanUp( $txt );
262256 $txt = preg_replace( "/[\013\035\037]/", "", $txt );
263257 $reg = <<<EOR
264258 /\(page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*"

Follow-up revisions

RevisionCommit summaryAuthorDate
r69631fixes r69333 — remove dependency on iconv, use icu or native onlymah16:14, 20 July 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61258if available, use iconv because it requires less memory (fixes bug 21809) (fo...thomasv17:23, 19 January 2010

Comments

#Comment by OverlordQ (talk | contribs)   08:27, 18 July 2010

Breaks a parser test.

1 previously passing test(s) now FAILING! :(

  • (bug 19451) Links should refer to the normalized form. [Introduced between 18-Jul-2010 08:23:05, 1.17alpha (r69332) and 18-Jul-2010 08:23:42, 1.17alpha (r69333)]
Running test  Links should refer to the normalized form.... FAILED!
--- /tmp/mwParser-987350358-expected    2010-07-18 08:23:50.000000000 +0000
+++ /tmp/mwParser-987350358-actual      2010-07-18 08:23:50.000000000 +0000
@@ -1,4 +1,4 @@
-<p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
+<p><a href="/index.php?title=%EF%AC%AE&amp;action=edit&amp;redlink=1" class="new" title="אַ (page does not exist)">&#xfb2e;</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
#Comment by MarkAHershberger (talk | contribs)   16:14, 20 July 2010

See r69631

Status & tagging log