From 9b75e95ef027c476c5c071afabfe466258e680eb Mon Sep 17 00:00:00 2001 From: Ilmari Karonen Date: Thu, 20 Aug 2009 14:56:11 +0000 Subject: [PATCH] (bug 15248) Normalize NBSP and other odd Unicode whitespace characters to normal spaces. Note: run cleanupTitles.php and cleanupImages.php after deploying this! --- RELEASE-NOTES | 3 +++ includes/Title.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 ) { -- 2.20.1