From 7185b93aa3646a2c5fd18bfe1cb2eaf72abccfb2 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 13 Oct 2006 23:32:36 +0000 Subject: [PATCH] * (bug 7562) Fix non-ASCII namespaces on Windows/XAMPP servers strtolower() tends to corrupt data when locale is not UTF-8, as on Windows. Use $wgContLang->lc() for namespace and interwiki normalization. --- RELEASE-NOTES | 1 + includes/Title.php | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0a5670d2d0..47db220560 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -46,6 +46,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 2013) Inherit ratios and not computed values for line-height * Added global $wgStyleVersion to centralize bumping CSS and JS file versions for cache-friendly style and script updating +* (bug 7562) Fix non-ASCII namespaces on Windows/XAMPP servers == Languages updated == diff --git a/includes/Title.php b/includes/Title.php index 615d92f824..d981a61223 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -356,7 +356,7 @@ class Title { $lc = SearchEngine::legalSearchChars() . '&#;'; $t = $wgContLang->stripForSearch( $title ); $t = preg_replace( "/[^{$lc}]+/", ' ', $t ); - $t = strtolower( $t ); + $t = $wgContLang->lc( $t ); # Handle 's, s' $t = preg_replace( "/([{$lc}]+)'s( |$)/", "\\1 \\1's ", $t ); @@ -393,10 +393,10 @@ class Title { */ function getInterwikiLink( $key ) { global $wgMemc, $wgInterwikiExpiry; - global $wgInterwikiCache; + global $wgInterwikiCache, $wgContLang; $fname = 'Title::getInterwikiLink'; - $key = strtolower( $key ); + $key = $wgContLang->lc( $key ); $k = wfMemcKey( 'interwiki', $key ); if( array_key_exists( $k, Title::$interwikiCache ) ) { @@ -1469,7 +1469,7 @@ class Title { do { if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $t, $m ) ) { $p = $m[1]; - $lowerNs = strtolower( $p ); + $lowerNs = $wgContLang->lc( $p ); if ( $ns = Namespace::getCanonicalIndex( $lowerNs ) ) { # Canonical namespace $t = $m[2]; @@ -1487,7 +1487,7 @@ class Title { # Interwiki link $t = $m[2]; - $this->mInterwiki = strtolower( $p ); + $this->mInterwiki = $wgContLang->lc( $p ); # Redundant interwiki prefix to the local wiki if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) { @@ -2344,6 +2344,7 @@ class Title { * @return string */ function getNamespaceKey() { + global $wgContLang; switch ($this->getNamespace()) { case NS_MAIN: case NS_TALK: @@ -2374,7 +2375,7 @@ class Title { case NS_CATEGORY_TALK: return 'nstab-category'; default: - return 'nstab-' . strtolower( $this->getSubjectNsText() ); + return 'nstab-' . $wgContLang->lc( $this->getSubjectNsText() ); } } } -- 2.20.1