r63993 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63992‎ | r63993 | r63994 >
Date:05:12, 21 March 2010
Author:simetrical
Status:ok
Tags:
Comment:
Use <meta charset=UTF-8> in HTML5

More succinct than <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />. HTML5 allows it because all browsers support it
anyway -- authors would forget quotes, leading to <meta
http-equiv=Content-Type content=text/html; charset=UTF-8 />, so browsers
all treat "charset" as an attribute of <meta> that does what you expect.
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -2075,7 +2075,6 @@
20762076 global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml;
20772077 global $wgUser, $wgRequest, $wgLang;
20782078
2079 - $this->addMeta( "http:Content-Type", "$wgMimeType; charset={$wgOutputEncoding}" );
20802079 if ( $sk->commonPrintStylesheet() ) {
20812080 $this->addStyle( 'common/wikiprintable.css', 'print' );
20822081 }
@@ -2117,6 +2116,7 @@
21182117 foreach ( $wgXhtmlNamespaces as $tag => $ns ) {
21192118 $htmlAttribs["xmlns:$tag"] = $ns;
21202119 }
 2120+ $this->addMeta( 'http:Content-Type', "$wgMimeType; charset=$wgOutputEncoding" );
21212121 }
21222122 $ret .= Html::element( 'html', $htmlAttribs ) . "\n";
21232123
@@ -2126,6 +2126,13 @@
21272127 $ret .= "$openHead\n";
21282128 }
21292129 $ret .= "<title>" . htmlspecialchars( $this->getHTMLTitle() ) . "</title>\n";
 2130+
 2131+ if ( $wgHtml5 ) {
 2132+ # More succinct than <meta http-equiv=Content-Type>, has the
 2133+ # same effect
 2134+ $ret .= Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n";
 2135+ }
 2136+
21302137 $ret .= implode( "\n", array(
21312138 $this->getHeadLinks(),
21322139 $this->buildCssLinks(),

Status & tagging log