Commit cec0a0fc authored by moodler's avatar moodler
Browse files

New developmental setting to force UTF for the whole server

Plus, some optimisation on the way encoding is stored (in the session).
parent 37aaf074
...@@ -148,6 +148,11 @@ $CFG->admin = 'admin'; ...@@ -148,6 +148,11 @@ $CFG->admin = 'admin';
// //
// Setting this to true will enable admins to edit any post at any time // Setting this to true will enable admins to edit any post at any time
// $CFG->admineditalways = true; // $CFG->admineditalways = true;
//
// This setting will put Moodle in Unicode mode. It's very new and
// most likely doesn't work yet. THIS IS FOR DEVELOPERS ONLY, IT IS
// NOT RECOMMENDED FOR PRODUCTION SITES
// $CFG->unicode = true;
......
...@@ -219,6 +219,7 @@ ...@@ -219,6 +219,7 @@
if (isset($_GET['lang'])) { if (isset($_GET['lang'])) {
$SESSION->lang = $lang; $SESSION->lang = $lang;
$SESSION->encoding = get_string('thischarset');
} }
if (empty($CFG->lang)) { if (empty($CFG->lang)) {
$CFG->lang = "en"; $CFG->lang = "en";
......
...@@ -375,7 +375,7 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc ...@@ -375,7 +375,7 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
$output = "<select name=\"$name\" $javascript>\n"; $output = "<select name=\"$name\" $javascript>\n";
if ($nothing) { if ($nothing) {
$output .= " <option value=\"$nothingvalue\"\n"; $output .= " <option value=\"$nothingvalue\"\n";
if ($nothingvalue == $selected) { if ($nothingvalue === $selected) {
$output .= " selected=\"true\""; $output .= " selected=\"true\"";
} }
$output .= ">$nothing</option>\n"; $output .= ">$nothing</option>\n";
...@@ -931,13 +931,15 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta= ...@@ -931,13 +931,15 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
// Add a stylesheet for the HTML editor // Add a stylesheet for the HTML editor
$meta = "<style type=\"text/css\">@import url($CFG->wwwroot/lib/editor/htmlarea.css);</style>\n$meta\n"; $meta = "<style type=\"text/css\">@import url($CFG->wwwroot/lib/editor/htmlarea.css);</style>\n$meta\n";
// Specify character set ... default is iso-8859-1 but some languages might need something else // Character set could be optimised by carrying the charset variable around in $USER
// Could be optimised by carrying the charset variable around in $USER if (!empty($CFG->unicode)) {
if (current_language() == "en") { $encoding = "utf-8";
$meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />\n$meta\n"; } else if (!empty($SESSION->encoding)) {
$encoding = $SESSION->encoding;
} else { } else {
$meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=".get_string("thischarset")."\" />\n$meta\n"; $encoding = get_string("thischarset");
} }
$meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=$encoding\" />\n$meta\n";
if ( get_string("thisdirection") == "rtl" ) { if ( get_string("thisdirection") == "rtl" ) {
$direction = " dir=\"rtl\""; $direction = " dir=\"rtl\"";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment