Kill off the long deprecated $wgInputEncoding and $wgOutputEncoding globals
authorSam Reed <reedy@users.mediawiki.org>
Fri, 6 May 2011 22:09:47 +0000 (22:09 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Fri, 6 May 2011 22:09:47 +0000 (22:09 +0000)
14 files changed:
includes/DefaultSettings.php
includes/Exception.php
includes/ExternalEdit.php
includes/Html.php
includes/Metadata.php
includes/OutputPage.php
includes/RawPage.php
includes/Revision.php
includes/SkinTemplate.php
includes/UserMailer.php
includes/cache/HTMLFileCache.php
includes/diff/DifferenceEngine.php
includes/specials/SpecialSearch.php
languages/Language.php

index b3c2049..c06586d 100644 (file)
@@ -1870,11 +1870,6 @@ $wgDummyLanguageCodes = array(
        'simple',
 );
 
-/** @deprecated Since MediaWiki 1.5, this must always be set to UTF-8. */
-$wgInputEncoding  = 'UTF-8';
-/** @deprecated Since MediaWiki 1.5, this must always be set to UTF-8. */
-$wgOutputEncoding = 'UTF-8';
-
 /**
  * Character set for use in the article edit box. Language-specific encodings
  * may be defined.
index 67ad329..1db0b02 100644 (file)
@@ -221,11 +221,11 @@ class MWException extends Exception {
         * $wgOut to output the exception.
         */
        function htmlHeader() {
-               global $wgLogo, $wgOutputEncoding, $wgLang;
+               global $wgLogo, $wgLang;
 
                if ( !headers_sent() ) {
                        header( 'HTTP/1.0 500 Internal Server Error' );
-                       header( 'Content-type: text/html; charset=' . $wgOutputEncoding );
+                       header( 'Content-type: text/html; charset=UTF-8' );
                        /* Don't cache error pages!  They cause no end of trouble... */
                        header( 'Cache-control: none' );
                        header( 'Pragma: nocache' );
index 7109c1a..094ae8f 100644 (file)
 class ExternalEdit {
 
        function __construct( $article, $mode ) {
-               global $wgInputEncoding;
                $this->mArticle =& $article;
                $this->mTitle =& $article->mTitle;
-               $this->mCharset = $wgInputEncoding;
+               $this->mCharset = 'UTF-8';
                $this->mMode = $mode;
        }
 
index ea33533..43419e7 100644 (file)
@@ -609,9 +609,9 @@ class Html {
        public static function htmlHeader( $attribs = array() ) {
                $ret = '';
 
-               global $wgMimeType, $wgOutputEncoding;
+               global $wgMimeType;
                if ( self::isXmlMimeType( $wgMimeType ) ) {
-                       $ret .= "<?xml version=\"1.0\" encoding=\"$wgOutputEncoding\" ?" . ">\n";
+                       $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
                }
 
                global $wgHtml5, $wgHtml5Version, $wgDocType, $wgDTD;
index 93ce4b2..5f9a13b 100644 (file)
@@ -212,11 +212,9 @@ class DublinCoreRdf extends RdfMetaData {
         * begin of the page
         */
        protected function prologue() {
-               global $wgOutputEncoding;
-
                $url = htmlspecialchars( $this->reallyFullUrl() );
                print <<<PROLOGUE
-<?xml version="1.0" encoding="{$wgOutputEncoding}" ?>
+<?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE rdf:RDF PUBLIC "-//DUBLIN CORE//DCMES DTD 2002/07/31//EN" "http://dublincore.org/documents/2002/07/31/dcmes-xml/dcmes-xml-dtd.dtd">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:dc="http://purl.org/dc/elements/1.1/">
@@ -269,9 +267,8 @@ class CreativeCommonsRdf extends RdfMetaData {
        }
 
        protected function prologue() {
-               global $wgOutputEncoding;
                echo <<<PROLOGUE
-<?xml version='1.0'  encoding="{$wgOutputEncoding}" ?>
+<?xml version='1.0'  encoding="UTF-8" ?>
 <rdf:RDF xmlns:cc="http://web.resource.org/cc/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
index 2f8d85b..640b4a3 100644 (file)
@@ -1838,7 +1838,6 @@ class OutputPage {
         * the object, let's actually output it:
         */
        public function output() {
-               global $wgOutputEncoding;
                global $wgLanguageCode, $wgDebugRedirects, $wgMimeType;
 
                if( $this->mDoNothing ) {
@@ -1882,7 +1881,7 @@ class OutputPage {
                # Buffer output; final headers may depend on later processing
                ob_start();
 
-               $response->header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
+               $response->header( "Content-type: $wgMimeType; charset=UTF-8" );
                $response->header( 'Content-language: ' . $wgLanguageCode );
 
                // Prevent framing, if requested
@@ -1919,11 +1918,11 @@ class OutputPage {
         * @param $ins String: the string to output
         */
        public function out( $ins ) {
-               global $wgInputEncoding, $wgOutputEncoding, $wgContLang;
-               if ( 0 == strcmp( $wgInputEncoding, $wgOutputEncoding ) ) {
+               global $wgContLang;
+               if ( 0 == strcmp( 'UTF-8', 'UTF-8' ) ) {
                        $outs = $ins;
                } else {
-                       $outs = $wgContLang->iconv( $wgInputEncoding, $wgOutputEncoding, $ins );
+                       $outs = $wgContLang->iconv( 'UTF-8', 'UTF-8', $ins );
                        if ( false === $outs ) {
                                $outs = $ins;
                        }
@@ -2684,7 +2683,7 @@ class OutputPage {
         */
        public function getHeadLinks( Skin $sk, $addContentType = false ) {
                global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
-                       $wgSitename, $wgVersion, $wgHtml5, $wgMimeType, $wgOutputEncoding,
+                       $wgSitename, $wgVersion, $wgHtml5, $wgMimeType,
                        $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
                        $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf,
                        $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang,
@@ -2696,11 +2695,11 @@ class OutputPage {
                        if ( $wgHtml5 ) {
                                # More succinct than <meta http-equiv=Content-Type>, has the
                                # same effect
-                               $tags[] = Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) );
+                               $tags[] = Html::element( 'meta', array( 'charset' => 'UTF-8' ) );
                        } else {
                                $tags[] = Html::element( 'meta', array(
                                        'http-equiv' => 'Content-Type',
-                                       'content' => "$wgMimeType; charset=$wgOutputEncoding"
+                                       'content' => "$wgMimeType; charset=UTF-8"
                                ) );
                                $tags[] = Html::element( 'meta', array(  // bug 15835
                                        'http-equiv' => 'Content-Style-Type',
index 0608c22..c994cb7 100644 (file)
@@ -24,7 +24,7 @@ class RawPage {
        var $mContentType, $mExpandTemplates;
 
        function __construct( Article $article, $request = false ) {
-               global $wgRequest, $wgInputEncoding, $wgSquidMaxage, $wgJsMimeType, $wgGroupPermissions;
+               global $wgRequest, $wgSquidMaxage, $wgJsMimeType, $wgGroupPermissions;
 
                $allowedCTypes = array( 'text/x-wiki', $wgJsMimeType, 'text/css', 'application/x-zope-edit' );
                $this->mArticle = $article;
@@ -89,7 +89,7 @@ class RawPage {
                } else {
                        $this->mGen = false;
                }
-               $this->mCharset = $wgInputEncoding;
+               $this->mCharset = 'UTF-8';
 
                # Force caching for CSS and JS raw content, default: 5 minutes
                if( is_null( $smaxage ) && ( $ctype == 'text/css' || $ctype == $wgJsMimeType ) ) {
index 5fff018..fde0543 100644 (file)
@@ -760,8 +760,8 @@ class Revision {
                                # Upconvert on demand.
                                # ("utf8" checked for compatibility with some broken
                                #  conversion scripts 2008-12-30)
-                               global $wgInputEncoding, $wgContLang;
-                               $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding, $text );
+                               global $wgContLang;
+                               $text = $wgContLang->iconv( $wgLegacyEncoding, 'UTF-8', $text );
                        }
                }
                wfProfileOut( __METHOD__ );
index 9404c6b..4b60b2b 100644 (file)
@@ -134,7 +134,7 @@ class SkinTemplate extends Skin {
        function outputPage( OutputPage $out ) {
                global $wgUser, $wgLang, $wgContLang;
                global $wgScript, $wgStylePath, $wgLanguageCode;
-               global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
+               global $wgMimeType, $wgJsMimeType, $wgRequest;
                global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
                global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
                global $wgMaxCredits, $wgShowCreditsIfMax;
@@ -274,7 +274,7 @@ class SkinTemplate extends Skin {
 
                $tpl->setRef( 'mimetype', $wgMimeType );
                $tpl->setRef( 'jsmimetype', $wgJsMimeType );
-               $tpl->setRef( 'charset', $wgOutputEncoding );
+               $tpl->setRef( 'charset', 'UTF-8' );
                $tpl->setRef( 'wgScript', $wgScript );
                $tpl->setRef( 'skinname', $this->skinname );
                $tpl->set( 'skinclass', get_class( $this ) );
index cca9c59..a2e11d7 100644 (file)
@@ -110,7 +110,7 @@ class UserMailer {
         * @return Status object
         */
        public static function send( $to, $from, $subject, $body, $replyto = null, $contentType = null ) {
-               global $wgSMTP, $wgOutputEncoding, $wgEnotifImpersonal;
+               global $wgSMTP, $wgEnotifImpersonal;
                global $wgEnotifMaxRecips, $wgAdditionalMailParams;
 
                if ( is_array( $to ) ) {
@@ -164,7 +164,7 @@ class UserMailer {
                        $headers['Date'] = date( 'r' );
                        $headers['MIME-Version'] = '1.0';
                        $headers['Content-type'] = ( is_null( $contentType ) ?
-                                       'text/plain; charset=' . $wgOutputEncoding : $contentType );
+                                       'text/plain; charset=UTF-8' : $contentType );
                        $headers['Content-transfer-encoding'] = '8bit';
                        $headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>'; // FIXME
                        $headers['X-Mailer'] = 'MediaWiki mailer';
@@ -203,7 +203,7 @@ class UserMailer {
                                $endl = "\n";
                        }
                        $ctype = ( is_null( $contentType ) ?
-                                       'text/plain; charset=' . $wgOutputEncoding : $contentType );
+                                       'text/plain; charset=UTF-8' : $contentType );
                        $headers =
                                "MIME-Version: 1.0$endl" .
                                "Content-type: $ctype$endl" .
@@ -277,8 +277,7 @@ class UserMailer {
        public static function quotedPrintable( $string, $charset = '' ) {
                # Probably incomplete; see RFC 2045
                if( empty( $charset ) ) {
-                       global $wgInputEncoding;
-                       $charset = $wgInputEncoding;
+                       $charset = 'UTF-8';
                }
                $charset = strtoupper( $charset );
                $charset = str_replace( 'ISO-8859', 'ISO8859', $charset ); // ?
index 949ed36..4b3ef27 100644 (file)
@@ -155,14 +155,14 @@ class HTMLFileCache {
 
        /* Working directory to/from output */
        public function loadFromFileCache() {
-               global $wgOut, $wgMimeType, $wgOutputEncoding, $wgLanguageCode;
+               global $wgOut, $wgMimeType, $wgLanguageCode;
                wfDebug( __METHOD__ . "()\n");
                $filename = $this->fileCacheName();
                // Raw pages should handle cache control on their own,
                // even when using file cache. This reduces hits from clients.
                if( $this->mType !== 'raw' ) {
                        $wgOut->sendCacheControl();
-                       header( "Content-Type: $wgMimeType; charset={$wgOutputEncoding}" );
+                       header( "Content-Type: $wgMimeType; charset=UTF-8" );
                        header( "Content-Language: $wgLanguageCode" );
                }
 
index d2a0854..5ada4e7 100644 (file)
@@ -130,9 +130,9 @@ class DifferenceEngine {
                # we'll use the application/x-external-editor interface to call
                # an external diff tool like kompare, kdiff3, etc.
                if ( $wgUseExternalEditor && $wgUser->getOption( 'externaldiff' ) ) {
-                       global $wgInputEncoding, $wgServer, $wgScript, $wgLang;
+                       global $wgServer, $wgScript, $wgLang;
                        $wgOut->disable();
-                       header ( "Content-type: application/x-external-editor; charset=" . $wgInputEncoding );
+                       header ( "Content-type: application/x-external-editor; charset=UTF-8" );
                        $url1 = $this->mTitle->getFullURL( array(
                                'action' => 'raw',
                                'oldid' => $this->mOldid
index 2deb67c..9178542 100644 (file)
@@ -193,14 +193,13 @@ class SpecialSearch extends SpecialPage {
                                wfProfileOut( __METHOD__ );
                                return;
                        }
-                       global $wgInputEncoding;
                        $wgOut->addHTML(
                                Xml::openElement( 'fieldset' ) .
                                Xml::element( 'legend', null, wfMsg( 'search-external' ) ) .
                                Xml::element( 'p', array( 'class' => 'mw-searchdisabled' ), wfMsg( 'searchdisabled' ) ) .
                                wfMsg( 'googlesearch',
                                        htmlspecialchars( $term ),
-                                       htmlspecialchars( $wgInputEncoding ),
+                                       htmlspecialchars( 'UTF-8' ),
                                        htmlspecialchars( wfMsg( 'searchbutton' ) )
                                ) .
                                Xml::closeElement( 'fieldset' )
index 4420b27..8991ae2 100644 (file)
@@ -19,14 +19,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 global $wgLanguageNames;
 require_once( dirname( __FILE__ ) . '/Names.php' );
 
-global $wgInputEncoding, $wgOutputEncoding;
-
-/**
- * These are always UTF-8, they exist only for backwards compatibility
- */
-$wgInputEncoding    = 'UTF-8';
-$wgOutputEncoding      = 'UTF-8';
-
 if ( function_exists( 'mb_strtoupper' ) ) {
        mb_internal_encoding( 'UTF-8' );
 }