diff --git a/admin/dbtransfer/lib.php b/admin/dbtransfer/lib.php index 6d1b8199802..de868b352e2 100644 --- a/admin/dbtransfer/lib.php +++ b/admin/dbtransfer/lib.php @@ -26,7 +26,7 @@ function dbtransfer_export_xml_database($description, $mdb) { session_get_instance()->write_close(); // release session - header('Content-Type: application/xhtml+xml'); + header('Content-Type: application/xhtml+xml; charset=utf-8'); header('Content-Disposition: attachment; filename=database.xml'); header('Expires: 0'); header('Cache-Control: must-revalidate,post-check=0,pre-check=0'); diff --git a/admin/xmldb/index.php b/admin/xmldb/index.php index 4b80b2862b3..70c3f6da30d 100644 --- a/admin/xmldb/index.php +++ b/admin/xmldb/index.php @@ -103,7 +103,7 @@ echo $OUTPUT->footer(); break; case ACTION_GENERATE_XML: - header('Content-type: application/xhtml+xml'); + header('Content-type: application/xhtml+xml; charset=utf-8'); echo $xmldb_action->getOutput(); break; } diff --git a/calendar/export_execute.php b/calendar/export_execute.php index e4d62bd3229..3fe48f14f44 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -165,6 +165,6 @@ header('Pragma: no-cache'); header('Accept-Ranges: none'); // Comment out if PDFs do not work... header('Content-disposition: attachment; filename='.$filename); header('Content-length: '.strlen($serialized)); -header('Content-type: text/calendar'); +header('Content-type: text/calendar; charset=utf-8'); echo $serialized; diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 05853b42a13..67b715cc9ab 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -183,7 +183,7 @@ function refineTeX($texexp) { } function outputText($texexp) { - header("Content-type: text/html"); + header("Content-type: text/html; charset=utf-8"); echo "
\n";
if ($texexp) {
$texexp = str_replace('<','<',$texexp);
diff --git a/filter/tex/texdebug.php b/filter/tex/texdebug.php
index 48622240ce6..a53f2ee8822 100644
--- a/filter/tex/texdebug.php
+++ b/filter/tex/texdebug.php
@@ -96,7 +96,7 @@
function outputText($texexp) {
- header("Content-type: text/html");
+ header("Content-type: text/html; charset=utf-8");
echo "\n";
if ($texexp) {
$texexp = str_replace('<', '<', $texexp);
diff --git a/lib/ajax/getnavbranch.php b/lib/ajax/getnavbranch.php
index 623f790a10d..d00bef9db8a 100644
--- a/lib/ajax/getnavbranch.php
+++ b/lib/ajax/getnavbranch.php
@@ -48,7 +48,7 @@ try {
$navigation = new global_navigation_for_ajax($PAGE, $branchtype, $branchid);
$linkcategories = false;
-
+
if ($instanceid!==null) {
// Get the db record for the block instance
$blockrecord = $DB->get_record('block_instances', array('id'=>$instanceid,'blockname'=>'navigation'));
@@ -86,17 +86,17 @@ try {
$block->trim($navigation, $trimmode, $trimlength, ceil($trimlength/2));
}
$converter = new navigation_json();
-
+
// Find the actuall branch we are looking for
$branch = $navigation->find($branchid, $branchtype);
-
+
// Remove links to categories if required.
if (!$linkcategories) {
foreach ($branch->find_all_of_type(navigation_node::TYPE_CATEGORY) as $category) {
$category->action = null;
}
}
-
+
// Stop buffering errors at this point
$html = ob_get_contents();
ob_end_clean();
@@ -116,6 +116,6 @@ if (empty($branch) || $branch->nodetype !== navigation_node::NODETYPE_BRANCH) {
// Prepare an XML converter for the branch
$converter->set_expandable($navigation->get_expandable());
// Set XML headers
-header('Content-type: text/plain');
+header('Content-type: text/plain; charset=utf-8');
// Convert and output the branch as XML
echo $converter->convert($branch);
diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
index 39a0ac56fe2..bbcad53e1da 100644
--- a/lib/outputrenderers.php
+++ b/lib/outputrenderers.php
@@ -324,7 +324,7 @@ class core_renderer extends renderer_base {
$output .= html_writer::empty_tag('link', array('rel' => 'alternate',
'type' => $type, 'title' => $alt->title, 'href' => $alt->url));
}
-
+
if (!empty($CFG->additionalhtmlhead)) {
$output .= "\n".$CFG->additionalhtmlhead;
}
@@ -2719,9 +2719,9 @@ class core_renderer_ajax extends core_renderer {
public function header() {
// unfortunately YUI iframe upload does not support application/json
if (!empty($_FILES)) {
- @header('Content-type: text/plain');
+ @header('Content-type: text/plain; charset=utf-8');
} else {
- @header('Content-type: application/json');
+ @header('Content-type: application/json; charset=utf-8');
}
/// Headers to make it not cacheable and json
diff --git a/lib/setup.php b/lib/setup.php
index b1b9fbf3b97..e6777541895 100644
--- a/lib/setup.php
+++ b/lib/setup.php
@@ -162,7 +162,7 @@ if (defined('WEB_CRON_EMULATED_CLI')) {
// Detect CLI maintenance mode - this is useful when you need to mess with database, such as during upgrades
if (file_exists("$CFG->dataroot/climaintenance.html")) {
if (!CLI_SCRIPT) {
- header('Content-type: text/html');
+ header('Content-type: text/html; charset=utf-8');
/// Headers to make it not cacheable and json
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
diff --git a/lib/setuplib.php b/lib/setuplib.php
index 33ddf81c7f4..cbf6ffd5488 100644
--- a/lib/setuplib.php
+++ b/lib/setuplib.php
@@ -1268,7 +1268,7 @@ width: 80%; -moz-border-radius: 20px; padding: 15px">
$e->stacktrace = format_backtrace($backtrace, true);
}
}
- @header('Content-Type: application/json');
+ @header('Content-Type: application/json; charset=utf-8');
echo json_encode($e);
return;
}
diff --git a/mnet/publickey.php b/mnet/publickey.php
index 10ddcbe7bd9..ac018aeec94 100644
--- a/mnet/publickey.php
+++ b/mnet/publickey.php
@@ -15,6 +15,6 @@ if ($CFG->mnet_dispatcher_mode === 'off') {
print_error('mnetdisabled', 'mnet');
}
-header("Content-type: text/plain");
+header("Content-type: text/plain; charset=utf-8");
$keypair = mnet_get_keypair();
echo $keypair['certificate'];
diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php
index 9220c21edf4..f255c17dfd2 100755
--- a/mod/chat/chatd.php
+++ b/mod/chat/chatd.php
@@ -363,7 +363,7 @@ EOD;
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
- $header .= "Content-Type: text/html\n";
+ $header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
@@ -383,7 +383,7 @@ EOD;
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
- $header .= "Content-Type: text/html\n";
+ $header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
@@ -461,7 +461,7 @@ EOD;
$header .= "Connection: close\n";
$header .= "Date: ".date('r')."\n";
$header .= "Server: Moodle\n";
- $header .= "Content-Type: text/html\n";
+ $header .= "Content-Type: text/html; charset=utf-8\n";
$header .= "Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT\n";
$header .= "Cache-Control: no-cache, must-revalidate\n";
$header .= "Expires: Wed, 4 Oct 1978 09:32:45 GMT\n";
diff --git a/mod/data/css.php b/mod/data/css.php
index 62b7bc5fae8..a6f9616d96e 100755
--- a/mod/data/css.php
+++ b/mod/data/css.php
@@ -37,7 +37,7 @@ if ($data = $DB->get_record('data', array('id'=>$d))) {
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
header('Cache-control: max_age = '. $lifetime);
header('Pragma: ');
- header('Content-type: text/css'); // Correct MIME type
+ header('Content-type: text/css; charset=utf-8'); // Correct MIME type
echo $data->csstemplate;
}
\ No newline at end of file
diff --git a/mod/data/js.php b/mod/data/js.php
index 455b7d089a4..38811ea23a9 100644
--- a/mod/data/js.php
+++ b/mod/data/js.php
@@ -38,7 +38,7 @@ if ($data = $DB->get_record('data', array('id'=>$d))) {
header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $lifetime) . ' GMT');
header('Cache-control: max_age = '. $lifetime);
header('Pragma: ');
- header('Content-type: text/css'); // Correct MIME type
+ header('Content-type: text/css; charset=utf-8'); // Correct MIME type
echo $data->jstemplate;
}
\ No newline at end of file
diff --git a/repository/repository_ajax.php b/repository/repository_ajax.php
index f460f78baf4..0da0fc5390f 100755
--- a/repository/repository_ajax.php
+++ b/repository/repository_ajax.php
@@ -52,7 +52,7 @@ $saveas_path = optional_param('savepath', '/', PARAM_PATH); // save as file
$search_text = optional_param('s', '', PARAM_CLEANHTML);
$linkexternal = optional_param('linkexternal', '', PARAM_ALPHA);
-@header('Content-type: text/plain');
+@header('Content-type: text/plain; charset=utf-8');
// if uploaded file is larger than post_max_size (php.ini) setting, $_POST content will lost
if (empty($_POST) && !empty($action)) {
diff --git a/theme/javascript.php b/theme/javascript.php
index 6e44df147cf..983731b30da 100644
--- a/theme/javascript.php
+++ b/theme/javascript.php
@@ -95,7 +95,7 @@ function send_cached_js($jspath) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
- header('Content-Type: application/javascript');
+ header('Content-Type: application/javascript; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($jspath));
}
@@ -110,7 +110,7 @@ function send_uncached_js($js) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + 2) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
- header('Content-Type: application/javascript');
+ header('Content-Type: application/javascript; charset=utf-8');
header('Content-Length: '.strlen($js));
echo $js;
diff --git a/theme/styles.php b/theme/styles.php
index 72694ca0dc6..2e99fe07672 100644
--- a/theme/styles.php
+++ b/theme/styles.php
@@ -132,7 +132,7 @@ EOF;
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
- header('Content-Type: text/css');
+ header('Content-Type: text/css; charset=utf-8');
header('Content-Length: '.strlen($css));
echo $css;
@@ -147,7 +147,7 @@ function send_cached_css($csspath, $rev) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
- header('Content-Type: text/css');
+ header('Content-Type: text/css; charset=utf-8');
if (!min_enable_zlib_compression()) {
header('Content-Length: '.filesize($csspath));
}
diff --git a/theme/styles_debug.php b/theme/styles_debug.php
index 712d1efa6a4..25a50e6a9b2 100644
--- a/theme/styles_debug.php
+++ b/theme/styles_debug.php
@@ -125,7 +125,7 @@ function send_uncached_css($css) {
header('Expires: '. gmdate('D, d M Y H:i:s', time() + THEME_DESIGNER_CACHE_LIFETIME) .' GMT');
header('Pragma: ');
header('Accept-Ranges: none');
- header('Content-Type: text/css');
+ header('Content-Type: text/css; charset=utf-8');
//header('Content-Length: '.strlen($css));
echo($css);
diff --git a/user/selector/search.php b/user/selector/search.php
index 7259956b17d..fcaf74ec3bb 100644
--- a/user/selector/search.php
+++ b/user/selector/search.php
@@ -35,7 +35,7 @@ if (debugging('', DEBUG_DEVELOPER) && optional_param('debug', false, PARAM_BOOL)
header('Content-type: text/plain; charset=UTF-8');
$debugmode = true;
} else {
- header('Content-type: application/json');
+ header('Content-type: application/json; charset=utf-8');
$debugmode = false;
}
diff --git a/webservice/rest/locallib.php b/webservice/rest/locallib.php
index 9c5d40bedde..8feba8f2330 100644
--- a/webservice/rest/locallib.php
+++ b/webservice/rest/locallib.php
@@ -66,7 +66,7 @@ class webservice_rest_server extends webservice_base_server {
$this->functionname = isset($_REQUEST['wsfunction']) ? $_REQUEST['wsfunction'] : null;
unset($_REQUEST['wsfunction']);
-
+
$this->parameters = $_REQUEST;
}
}
@@ -108,7 +108,7 @@ class webservice_rest_server extends webservice_base_server {
* @return void
*/
protected function send_headers() {
- header('Content-Type: application/xml');
+ header('Content-Type: application/xml; charset=utf-8');
header('Content-Disposition: inline; filename="response.xml"');
header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0');
header('Expires: '. gmdate('D, d M Y H:i:s', 0) .' GMT');
@@ -142,7 +142,7 @@ class webservice_rest_server extends webservice_base_server {
if (!empty($returns)) {
foreach ($returns as $val) {
$mult .= self::xmlize_result($val, $desc->content);
- }
+ }
}
$mult .= ''."\n";
return $mult;
diff --git a/webservice/soap/locallib.php b/webservice/soap/locallib.php
index 3d477ebefb8..02e262b19ad 100644
--- a/webservice/soap/locallib.php
+++ b/webservice/soap/locallib.php
@@ -56,7 +56,7 @@ class webservice_soap_server extends webservice_zend_server {
global $CFG;
parent::init_zend_server();
-
+
if ($this->authmethod == WEBSERVICE_AUTHMETHOD_USERNAME) {
$username = optional_param('wsusername', '', PARAM_RAW);
$password = optional_param('wspassword', '', PARAM_RAW);
@@ -129,7 +129,7 @@ class webservice_soap_server extends webservice_zend_server {
';
$this->send_headers();
- header('Content-Type: application/xml');
+ header('Content-Type: application/xml; charset=utf-8');
header('Content-Disposition: inline; filename="response.xml"');
echo $xml;