Specify the utf-8 charset on error messages.
authorPlatonides <platonides@gmail.com>
Wed, 3 Apr 2013 23:28:33 +0000 (01:28 +0200)
committerPlatonides <platonides@gmail.com>
Wed, 3 Apr 2013 23:28:33 +0000 (01:28 +0200)
Although the contents of error messages are English text,
and thus it's irrelevant that it gets interpreted as
iso-8859-1 instead of utf-8, $wgSitename is printed by
DBConnectionError::searchForm(), and that can contain utf-8.

Cached pages may also be in utf-8.

Change-Id: I81c02493f0824cb010c80f4356f338787d78df6b

includes/Exception.php

index dc34320..21952bb 100644 (file)
@@ -247,7 +247,7 @@ class MWException extends Exception {
         * It will be either HTML or plain text based on isCommandLine().
         */
        function report() {
-               global $wgLogExceptionBacktrace;
+               global $wgLogExceptionBacktrace, $wgMimeType;
                $log = $this->getLogMessage();
 
                if ( $log ) {
@@ -267,6 +267,7 @@ class MWException extends Exception {
                } else {
                        header( "HTTP/1.1 500 MediaWiki exception" );
                        header( "Status: 500 MediaWiki exception", true );
+                       header( "Content-Type: $wgMimeType; charset=utf-8", true );
 
                        $this->reportHTML();
                }