* (bug 563) Fix UTF-8 interwiki URL redirects via Latin-1 wikis
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 27 Feb 2005 09:58:49 +0000 (09:58 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 27 Feb 2005 09:58:49 +0000 (09:58 +0000)
index.php

index 0df5541..cbb5137 100644 (file)
--- a/index.php
+++ b/index.php
@@ -69,6 +69,12 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
        $wgOut->errorpage( 'badtitle', 'badtitletext' );
 } else if ( $wgTitle->getInterwiki() != '' ) {
+       if( $wgUseLatin1 ) {
+               # Conversion from UTF-8 may truncate or corrupt non-Latin links.
+               # Grab a fresh copy without doing the automated conversion checks.
+               $interwiki = Title::newFromUrl( $_REQUEST['title'] );
+               if( !is_null( $interwiki ) ) $wgTitle = $interwiki;
+       }
        $url = $wgTitle->getFullURL();
        # Check for a redirect loop
        if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $wgTitle->isLocal() ) {