From 0880258f2af88f7edf886365d2364d0349fffe19 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 21 Mar 2010 05:12:15 +0000 Subject: [PATCH] Use in HTML5 More succinct than . HTML5 allows it because all browsers support it anyway -- authors would forget quotes, leading to , so browsers all treat "charset" as an attribute of that does what you expect. --- includes/OutputPage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 4a2b819866..3685f5dcaa 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2075,7 +2075,6 @@ class OutputPage { global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml; global $wgUser, $wgRequest, $wgLang; - $this->addMeta( "http:Content-Type", "$wgMimeType; charset={$wgOutputEncoding}" ); if ( $sk->commonPrintStylesheet() ) { $this->addStyle( 'common/wikiprintable.css', 'print' ); } @@ -2117,6 +2116,7 @@ class OutputPage { foreach ( $wgXhtmlNamespaces as $tag => $ns ) { $htmlAttribs["xmlns:$tag"] = $ns; } + $this->addMeta( 'http:Content-Type', "$wgMimeType; charset=$wgOutputEncoding" ); } $ret .= Html::element( 'html', $htmlAttribs ) . "\n"; @@ -2126,6 +2126,13 @@ class OutputPage { $ret .= "$openHead\n"; } $ret .= "" . htmlspecialchars( $this->getHTMLTitle() ) . "\n"; + + if ( $wgHtml5 ) { + # More succinct than , has the + # same effect + $ret .= Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n"; + } + $ret .= implode( "\n", array( $this->getHeadLinks(), $this->buildCssLinks(), -- 2.20.1