(bug 15248) Normalize NBSP and other odd Unicode whitespace characters to normal...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 20 Aug 2009 14:56:11 +0000 (14:56 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Thu, 20 Aug 2009 14:56:11 +0000 (14:56 +0000)
Note: run cleanupTitles.php and cleanupImages.php after deploying this!

RELEASE-NOTES
includes/Title.php

index 138d626..2d0947a 100644 (file)
@@ -415,6 +415,9 @@ this. Was used when mwEmbed was going to be an extension.
   versions of MediaWiki were affected).
 * (bug 14817) Moving a page to a subpage of itself moves it twice
 * (bug 20289) $wgMaximumMovedPages should only count pages actually moved
+* (bug 15248) Non-breaking spaces and certain other Unicode space characters
+  are now normalized to ordinary spaces in titles; if your wiki has existing
+  titles with such characters, run cleanupTitles.php and/or cleanupImages.php
 
 == API changes in 1.16 ==
 
index 5b5c06f..48063be 100644 (file)
@@ -2242,7 +2242,7 @@ class Title {
 
                # Clean up whitespace
                #
-               $dbkey = preg_replace( '/[ _]+/', '_', $dbkey );
+               $dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200B}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey );
                $dbkey = trim( $dbkey, '_' );
 
                if ( '' == $dbkey ) {