Do not urlencode anchor in links we output
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 2 Jan 2009 20:59:07 +0000 (20:59 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 2 Jan 2009 20:59:07 +0000 (20:59 +0000)
This fixes non-TOC links in IE5, 5.5, and 6 (didn't test 7) when
$wgEnforceHtmlIds is off.  These browsers won't follow urlencoded
Unicode anchors in href's, they only work if not urlencoded.  Having
non-urlencoded bits in href's should be perfectly fine, correct me if
I'm wrong.

As far as I can tell, Title::escapeFragmentForURL() is never used for
HTTP redirects, if there's any concern about those.  The correct
function to fix those is Article::doRedirect().  My testing indicates
that IE{5,5.5,6} will not accept Unicode anchors in anchors in HTTP
redirects, whether urlencoded or not.

includes/Title.php

index 17107c7..f91ac09 100644 (file)
@@ -452,8 +452,8 @@ class Title {
         */
        static function escapeFragmentForURL( $fragment ) {
                global $wgEnforceHtmlIds;
-               return wfUrlencode( Sanitizer::escapeId( $fragment,
-                       $wgEnforceHtmlIds ? array() : 'xml' ) );
+               return Sanitizer::escapeId( $fragment,
+                       $wgEnforceHtmlIds ? array() : 'xml' );
        }
 
 #----------------------------------------------------------------------------