From: Ilmari Karonen Date: Thu, 20 Aug 2009 14:56:11 +0000 (+0000) Subject: (bug 15248) Normalize NBSP and other odd Unicode whitespace characters to normal... X-Git-Tag: 1.31.0-rc.0~40176 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=9b75e95ef027c476c5c071afabfe466258e680eb;p=lhc%2Fweb%2Fwiklou.git (bug 15248) Normalize NBSP and other odd Unicode whitespace characters to normal spaces. Note: run cleanupTitles.php and cleanupImages.php after deploying this! --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 138d626ef7..2d0947a1c7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Title.php b/includes/Title.php index 5b5c06f525..48063be64e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 ) {