]> git.mjollnir.org Git - moodle.git/commitdiff
New developmental setting to force UTF for the whole server
authormoodler <moodler>
Tue, 27 Apr 2004 13:57:46 +0000 (13:57 +0000)
committermoodler <moodler>
Tue, 27 Apr 2004 13:57:46 +0000 (13:57 +0000)
Plus, some optimisation on the way encoding is stored (in the session).

config-dist.php
lib/setup.php
lib/weblib.php

index 1e9cf6e3d43634c3d2aa0c06c19351830e9c3a44..d0399ac31757699e40b38e4fee0492e9cd03cc41 100644 (file)
@@ -148,6 +148,11 @@ $CFG->admin = 'admin';
 //
 // Setting this to true will enable admins to edit any post at any time
 //      $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;
 
 
 
index 774bc52d77825262db71d0f20861a98cf3d06862..1513a9d085ab506008bf4253eb116f04639fc325 100644 (file)
 
     if (isset($_GET['lang'])) {
         $SESSION->lang = $lang;
+        $SESSION->encoding = get_string('thischarset');
     }
     if (empty($CFG->lang)) {
         $CFG->lang = "en";
index e67281b5b0732aae1c858a9ae179986cb9fa27bc..b0ced0c45a2b46c377e58fbbf1ea5444a66f2d8d 100644 (file)
@@ -375,7 +375,7 @@ function choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
     $output = "<select name=\"$name\" $javascript>\n";
     if ($nothing) {
         $output .= "   <option value=\"$nothingvalue\"\n";
-        if ($nothingvalue == $selected) {
+        if ($nothingvalue === $selected) {
             $output .= " selected=\"true\"";
         }
         $output .= ">$nothing</option>\n";
@@ -931,13 +931,15 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
     // Add a stylesheet for the HTML editor
     $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
-    // Could be optimised by carrying the charset variable around in $USER
-    if (current_language() == "en") {
-        $meta = "<meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />\n$meta\n";
+    // Character set could be optimised by carrying the charset variable around in $USER
+    if (!empty($CFG->unicode)) {
+        $encoding = "utf-8";
+    } else if (!empty($SESSION->encoding)) {
+        $encoding = $SESSION->encoding;
     } 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" ) {
         $direction = " dir=\"rtl\"";