]> git.mjollnir.org Git - moodle.git/commitdiff
we are going 100% unicode now - removed use of $CFG->unicodedb and current_charset...
authorskodak <skodak>
Sat, 11 Nov 2006 17:23:20 +0000 (17:23 +0000)
committerskodak <skodak>
Sat, 11 Nov 2006 17:23:20 +0000 (17:23 +0000)
48 files changed:
admin/cron.php
admin/index.php
admin/settings/server.php
admin/xmldb/actions/test/test.class.php
auth/db/lib.php
auth/ldap/lib.php
auth/shibboleth/lib.php
backup/backuplib.php
backup/lib.php
backup/restorelib.php
blocks/rss_client/block_rss_client.php
blocks/rss_client/block_rss_client_action.php
config-dist.php
enrol/paypal/enrol.php
lib/ddllib.php
lib/dmllib.php
lib/excellib.class.php
lib/filelib.php
lib/filterlib.php
lib/graphlib.php
lib/moodlelib.php
lib/phpmailer/class.phpmailer.php
lib/rsslib.php
lib/setup.php
lib/weblib.php
message/discussion.php
message/messages.php
message/refresh.php
message/send.php
mod/chat/gui_header_js/index.php
mod/chat/gui_header_js/jsupdate.php
mod/chat/gui_header_js/jsupdated.php
mod/chat/gui_sockets/index.php
mod/glossary/lib.php
mod/glossary/print.php
mod/glossary/sql.php
mod/glossary/view.php
mod/label/lib.php
mod/resource/type/file/resource.class.php
mod/resource/type/ims/preview.php
mod/resource/type/ims/resource.class.php
mod/scorm/datamodels/scormlib.php
mod/workshop/assess.php
mod/workshop/viewassessment.php
question/format/hotpot/format.php
question/format/qti2/format.php
user/edit.html
user/edit.php

index b890c35cdfb351c4c690a6c767b6f8750260704f..568f4c244355e083e23a7f14e0b739551be38e99 100644 (file)
 /// send mime type and encoding
     if (check_browser_version('MSIE')) {
         //ugly IE hack to work around downloading instead of viewing
-        @header('Content-Type: text/html; charset='.current_charset());
+        @header('Content-Type: text/html; charset=utf-8');
         echo "<xmp>"; //<pre> is not good enough for us here
     } else {
         //send proper plaintext header
-        @header('Content-Type: text/plain; charset='.current_charset());
+        @header('Content-Type: text/plain; charset=utf-8');
     }
 
 /// Start output log
index 010ed90465ec0cb0da42a185130ab459ad38c2a6..26fb7c96eb4535975cc917cc55187c2a9e4ed399 100644 (file)
         if (!setup_is_unicodedb()) {
             // If could not convert successfully, throw error, and prevent installation
             print_error('unicoderequired', 'admin');  
-        }   
+        }
+        // all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
+        set_config('unicodedb', 1);
     
         $status = false;
         if (file_exists("$CFG->libdir/db/install.xml")) {
index a634dc4fa022fbfc9fe0e3d80c2acbb2ccee3265..dab850f24ab7027f3f7a175de682a4f8156b3f34 100644 (file)
@@ -47,15 +47,12 @@ $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestma
                                                                                                                                                           '21' => '21',
                                                                                                                                                           '22' => '22',
                                                                                                                                                           '23' => '23')));
-if (!empty($CFG->unicodedb)) { // These options are only available if running under unicodedb
-    unset($options);
-    unset($charsets);
-    $charsets = get_list_of_charsets();
-    $options['0'] = get_string('none');
-    $options = array_merge($options, $charsets);
-    $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
-    $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
-}
+$charsets = get_list_of_charsets();
+$options = array();
+$options['0'] = get_string('none');
+$options = array_merge($options, $charsets);
+$temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
+$temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
 $ADMIN->add('server', $temp, 100);
 
 
index 8c9067e75a9bc351e6f9324247d28ead8473de5d..2eaedfbd21203f8ad24ad5dc268c1bc083a7f117 100644 (file)
@@ -770,11 +770,11 @@ class test extends XMLDBAction {
             $rec->intro = addslashes($fulltext);
             $rec->name = 'texttest';
         /// Calculate its length
-            $textlen = $textlib->strlen($fulltext, current_charset());
+            $textlen = $textlib->strlen($fulltext);
             if ($rec->id = insert_record('newnameforthetable', $rec)) {
                 if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
                     delete_records('newnameforthetable', 'id', $new->id);
-                    $newtextlen = $textlib->strlen($new->intro, current_charset());
+                    $newtextlen = $textlib->strlen($new->intro);
                     if ($rec->intro === $new->intro) {
                         $test->sql = array($newtextlen . ' cc. (text) sent and received ok');
                         $test->status = true;
@@ -831,11 +831,11 @@ class test extends XMLDBAction {
             $rec->avatar = addslashes($basetext);
             $rec->name = 'updatelobs';
         /// Calculate its length
-            $textlen = $textlib->strlen($basetext, current_charset());
+            $textlen = $textlib->strlen($basetext);
             $imglen = strlen($basetext);
             if (update_record('newnameforthetable', $rec)) {
                 if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
-                    $newtextlen = $textlib->strlen($new->intro, current_charset());
+                    $newtextlen = $textlib->strlen($new->intro);
                     $newimglen = strlen($new->avatar);
                     if ($rec->avatar === $new->avatar && $rec->intro === $new->intro) {
                         $test->sql = array($newtextlen . ' cc. (text) sent and received ok',
@@ -870,7 +870,7 @@ class test extends XMLDBAction {
             $rec->intro = addslashes($fulltext);
             $rec->name = 'updatelobs';
         /// Calculate its length
-            $textlen = $textlib->strlen($fulltext, current_charset());
+            $textlen = $textlib->strlen($fulltext);
             if (set_field('newnameforthetable', 'intro', $rec->intro, 'name', $rec->name)) {
                 if ($new = get_record('newnameforthetable', 'id', $rec->id)) {
                     $newtextlen = $textlib->strlen($new->intro);
index 153192b80952faa108c47710f443c72a3c61aaea..f8e78f0a6afec76e6b33cf004d4e645308435cf2 100644 (file)
@@ -104,11 +104,8 @@ function auth_get_userinfo($username){
             if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." FROM $CFG->auth_dbtable
                                         WHERE $CFG->auth_dbfielduser = '$username'")) {
                 if ( $rs->RecordCount() == 1 ) {
-                    if (!empty($CFG->unicodedb)) {
-                        $result["$field"] = addslashes(stripslashes($rs->fields[0]));
-                    } else {
-                        $result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0])));
-                    }
+                    // TODO: fix encoding conversion
+                    $result["$field"] = addslashes(stripslashes($rs->fields[0]));
                 }
             }
         }
index ccf96dfe90ca2b8eb71737c671443e7d12513f51..88947eda9b8b43f4c419aff774065ce6c6958d1a 100644 (file)
@@ -127,18 +127,12 @@ function auth_get_userinfo($username){
             $ldapval = NULL;
             foreach ($values as $value) {
                 if(is_array($user_entry[0][strtolower($value)])) {
-                    if (!empty($CFG->unicodedb)) {
-                        $newval = addslashes(stripslashes($user_entry[0][strtolower($value)][0]));
-                    } else {
-                        $newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)][0])));
-                    }
+                    // TODO: fix encoding conversion
+                    $newval = addslashes(stripslashes($user_entry[0][strtolower($value)][0]));
                 }
                 else {
-                    if (!empty($CFG->unicodedb)) {
-                        $newval = addslashes(stripslashes($user_entry[0][strtolower($value)]));
-                    } else {
-                        $newval = addslashes(stripslashes(utf8_decode($user_entry[0][strtolower($value)])));
-                    }
+                    // TODO: fix encoding conversion
+                    $newval = addslashes(stripslashes($user_entry[0][strtolower($value)]));
                 }
                 if (!empty($newval)) { // favour ldap entries that are set
                     $ldapval = $newval;
@@ -216,11 +210,7 @@ function auth_user_create ($userobject,$plainpass) {
         }
         foreach ($values as $value) {
             if(!empty($userobject->$key) ){
-                if (!empty($CFG->unicodedb)) {
-                    $newuser[$value]= $userobject->$key;
-                } else {
-                    $newuser[$value]=utf8_encode($userobject->$key);
-                }
+                $newuser[$value]= $userobject->$key;
             }
         }
     }
index b63e2615b8b44b05ec1bf6da6553bc84cce07c7a..038fd1dfa51e17468e767cefbede7473211906c3 100755 (executable)
@@ -44,11 +44,7 @@ function auth_get_userinfo($username) {
     $search_attribs = array();
   
     foreach ($attrmap as $key=>$value) {
-        if (!empty($CFG->unicodedb)) {
-            $result[$key]= get_first_string($_SERVER[$value]);
-        } else {
-            $result[$key]=get_first_string(utf8_decode($_SERVER[$value]));
-        }
+        $result[$key]= get_first_string($_SERVER[$value]);
     }
 
      // Provide an API to modify the information to fit the Moodle internal
index 5633189b24a777eb6072fbea7b4be7b1fccda76d..ac5f62db087f645dfd8d4b9e5e82f2bc917811cc 100644 (file)
         //because they are forbiden in XML 1.0 specs. The expression below seems to be
         //UTF-8 safe too because it simply ignores the rest of characters.
         $content = preg_replace("/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is","",$content);
-        if (!empty($CFG->unicodedb)) {
-            // Don't perform the conversion. Contents are Unicode.
-            $content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
-        } else {
-            // Perform the conversion. Contents aren't Unicode.
-            $content = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
-        } 
+        $content = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
         return $content; 
     }
 
index d28e2c1a6152d74063c534e8724b7b1608a8b968..c98f3203a50d2550305cfeb2ab328be70e0c30cf 100644 (file)
     //This function is used to add slashes (and decode from UTF-8 if needed)
     //It's used intensivelly when restoring modules and saving them in db
     function backup_todb ($data) {
-        global $CFG;
-
-        if (empty($CFG->unicodedb)) {
-            return restore_decode_absolute_links(addslashes(utf8_decode($data)));
-        } else {
-            return restore_decode_absolute_links(addslashes($data));
-        }
+        return restore_decode_absolute_links(addslashes($data));
     }
 
     //This function is used to check that every necessary function to 
index 60da142d17ec50b1c1ea98a5e441a549040de00e..19af8e50ec0fda5ff7bf1d3cf8763675bdf5e078 100644 (file)
             //Print backup general info
             print_table($table);
 
-            if ($info->backup_backup_version <= 2005070500 && !empty($CFG->unicodedb)) {
+            if ($info->backup_backup_version <= 2005070500) {
                  notify(get_string('backupnonisowarning'));  // Message informing that this backup may not work!
             }
 
         //This function is used to get the current contents property value
         //They are trimed (and converted from utf8 if needed)
         function getContents() {
-            global $CFG;
-
-            if (empty($CFG->unicodedb)) {
-                return trim(utf8_decode($this->content));
-            } else {
-                return trim($this->content);
-            }
+            return trim($this->content);
         }
  
         //This is the startTag handler we use where we are reading the info zone (todo="INFO")
index e0bde3a3b888fab278526f2a43fc3fc4bf02b121..6841dffb3d09a1e2c074952e03df808a72572b45 100644 (file)
         require_once($CFG->libdir .'/rsslib.php');
         require_once(MAGPIE_DIR .'rss_fetch.inc');
         if (!defined('MAGPIE_OUTPUT_ENCODING')) {
-            define('MAGPIE_OUTPUT_ENCODING', current_charset());  // see bug 3107
+            define('MAGPIE_OUTPUT_ENCODING', 'utf-8');  // see bug 3107
         }
 
         $rss_record = get_record('block_rss_client', 'id', $rssid);
      /// Loading the textlib singleton instance. We are going to need it.
          $textlib = textlib_get_instance();
 
-         if ($textlib->strlen($title,current_charset()) <= $max) {
+         if ($textlib->strlen($title) <= $max) {
              return $title;
          }
          else {
-             return $textlib->substr($title,0,$max-3,current_charset()).'...';
+             return $textlib->substr($title,0,$max-3).'...';
          }
      }
 }
index 54864d6f21150b24a29bfa1ab630e96b37dd6af5..01950c18248eb32c0eb8f5e6aa254147cf8b8973 100644 (file)
@@ -52,7 +52,7 @@ $shared         = optional_param('shared', 0, PARAM_INT);
 
 
 if (!defined('MAGPIE_OUTPUT_ENCODING')) {
-    define('MAGPIE_OUTPUT_ENCODING', current_charset());  // see bug 3107
+    define('MAGPIE_OUTPUT_ENCODING', 'utf-8');  // see bug 3107
 }
 
 
index 155273689264b84818f3063a3b64045f281c9c01..86d15ea0bd1a47a9bce4222a03a61d7e48c9c57d 100644 (file)
@@ -164,10 +164,6 @@ $CFG->admin = 'admin';
 //      $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
 //
 //
-// This setting will put Moodle in Unicode mode. Please note that database must support it.
-// Do not enable this if your database in not converted to UTF-8!
-//     $CFG->unicodedb = true;
-//
 // Allow unicode characters in uploaded files, generated reports, etc.
 // This setting is new and not much tested, there are known problems
 // with backup/restore that will not be solved, because native infozip
index fcf5f045578bd56b830a32adcb351d90b8ca5f08..ae596231fa0d0f212e0cb66e6ab8e8f71d89b023 100644 (file)
@@ -187,7 +187,7 @@ function process_config($config) {
 //To avoid wrong (for PayPal) characters in sent data
 function sanitise_for_paypal($text) {
     $textlib = textlib_get_instance();
-    $text  = $textlib->specialtoascii($text, current_charset());
+    $text  = $textlib->specialtoascii($text);
     // TODO: characters that have no ascii equivalents are not sanitized properly :-(
     return $text;
 }
index d290e969b909414fe32d7c0df3615d679be54c87..860aed6753faf68222f348ee2c11026d4ad729d9 100644 (file)
@@ -1157,11 +1157,10 @@ function rename_index($table, $index, $newname, $continue=true, $feedback=true)
 function change_db_encoding() {
     global $CFG, $db;  
     // try forcing utf8 collation, if mysql db and no tables present
-    if (empty($CFG->unicodedb) && ($CFG->dbtype=='mysql') && !$db->Metatables()) {
+    if (($CFG->dbtype=='mysql') && !$db->Metatables()) {
         $SQL = 'ALTER DATABASE '.$CFG->dbname.' CHARACTER SET utf8';
         execute_sql($SQL, false); // silent, if it fails it fails
         if (setup_is_unicodedb()) {
-            $CFG->unicodedb = true;
             configure_dbconnection();   
         }
     }
index cb22c699e755fc33c84a3c210765dec1e8a3cceb..78893cdac4ee7b1ec9b05b50e0ea20b676ae4d15 100644 (file)
@@ -1760,16 +1760,10 @@ function configure_dbconnection() {
 
     switch ($CFG->dbtype) {
         case 'mysql':
-        /// Set names if needed
-            if ($CFG->unicodedb) {
-                $db->Execute("SET NAMES 'utf8'");
-            }
+            $db->Execute("SET NAMES 'utf8'");
             break;
         case 'postgres7':
-        /// Set names if needed
-            if ($CFG->unicodedb) {
-                $db->Execute("SET NAMES 'utf8'");
-            }
+            $db->Execute("SET NAMES 'utf8'");
             break;
         case 'mssql':
         case 'mssql_n':
index 9d07f2823a259135e3d360380a9b3e29918f9656..04403403a3fe91e249f364f57653a66e84ac4710 100644 (file)
@@ -125,7 +125,7 @@ class MoodleExcelWorksheet {
     /// Loading the textlib singleton instance. We are going to need it.
         $textlib = textlib_get_instance();
     /// Convert the text from its original encoding to UTF-16LE
-        $str = $textlib->convert($str, current_charset(), 'utf-16le');
+        $str = $textlib->convert($str, 'utf-8', 'utf-16le');
     /// Add the string safely to the PEAR Worksheet
         $this->pear_excel_worksheet->writeString($row, $col, $str, $format);
     }
index b5d02b556dfabcf8d347015d89e2bf075aa5c212..641f2c762f213cae30e0ec2e5d1cd970d433b0a4 100644 (file)
@@ -312,7 +312,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=
             $filesize = strlen($path);
             $pathisstring = true;
         } else if ($mimetype == 'text/plain') {
-            @header('Content-Type: Text/plain; charset='.current_charset()); //add encoding
+            @header('Content-Type: Text/plain; charset=utf-8'); //add encoding
         } else {
             @header('Content-Type: '.$mimetype);
         }
@@ -357,7 +357,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=
             }
 
             @header('Content-Length: '.strlen($output));
-            @header('Content-Type: text/html; charset='.current_charset()); //add encoding
+            @header('Content-Type: text/html; charset=utf-8'); //add encoding
             while (@ob_end_flush()); //flush the buffers - save memory and disable sid rewrite
             echo $output;
         } else {    // Just send it out raw
index fec3a7f9d15e927435fb62ece0e69fb52a28c719..e7eb25d33086fc233fd8929c4e364bf9029a9822 100644 (file)
@@ -164,9 +164,8 @@ function filter_phrases ($text, &$link_array, $ignoretagsopen=NULL, $ignoretagsc
             }
         }
 
-        $u = empty($CFG->unicodedb) ? '' : 'u'; //regex unicode modifier
     /// Regular expression modifiers
-        $modifiers = ($linkobject->work_casesensitive) ? 's' : 'is'.$u;
+        $modifiers = ($linkobject->work_casesensitive) ? 's' : 'isu'; // works in unicode mode!
 
     /// Do we need to do a fullmatch?
     /// If yes then go through and remove any non full matching entries
index 4feb2ce73ba07cd43e98e135aa75b41948d092d7..6c79f3478a4c50f17fb3fadf9d14d87de1540b15 100644 (file)
@@ -1239,7 +1239,6 @@ function print_TTF($message) {
   }
   // start of Moodle addition
   $textlib = textlib_get_instance();
-  $text = $textlib->convert($text, current_charset(), 'UTF-8');
   $text = $textlib->utf8_to_entities($text, true, true); //does not work with hex entities!
   // end of Moodle addition
   ImageTTFText($this->image, $points, $angle, $x, $y, $colour, $font, $text);
@@ -1346,7 +1345,6 @@ function get_boundaryBox($message) {
   // get boundary box and offsets for printing at an angle
   // start of Moodle addition
   $textlib = textlib_get_instance();
-  $text = $textlib->convert($text, current_charset(), 'UTF-8');
   $text = $textlib->utf8_to_entities($text, true, true); //gd does not work with hex entities!
   // end of Moodle addition
   $bounds = ImageTTFBBox($points, $angle, $font, $text);
index 532d5e6e11e3cabfce0da511fbe5b8a2d583d0cc..e494b1d461368e060a61977ea31104cb72360845 100644 (file)
@@ -941,7 +941,7 @@ function userdate($date, $format='', $timezone=99, $fixday = true) {
    if ($CFG->ostype == 'WINDOWS') {
        if ($localewincharset = get_string('localewincharset')) {
            $textlib = textlib_get_instance();
-           $datestring = $textlib->convert($datestring, $localewincharset, 'UTF-8');
+           $datestring = $textlib->convert($datestring, $localewincharset, 'utf-8');
        }
    }
 
@@ -2458,7 +2458,7 @@ function validate_internal_user_password(&$user, $password) {
 
        // get password original encoding in case it was not updated to unicode yet
     $textlib = textlib_get_instance();
-    $convpassword = $textlib->convert($password, 'UTF-8', get_string('oldcharset'));
+    $convpassword = $textlib->convert($password, 'utf-8', get_string('oldcharset'));
 
     if ($user->password == md5($password.$CFG->passwordsaltmain) or $user->password == md5($password)
         or $user->password == md5($convpassword.$CFG->passwordsaltmain) or $user->password == md5($convpassword)) {
@@ -3318,7 +3318,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
     $mail->Version = 'Moodle '. $CFG->version;           // mailer version
     $mail->PluginDir = $CFG->libdir .'/phpmailer/';      // plugin directory (eg smtp plugin)
 
-    $mail->CharSet = 'UTF-8';
+    $mail->CharSet = 'utf-8';
 
     if ($CFG->smtphosts == 'qmail') {
         $mail->IsQmail();                              // use Qmail system
@@ -4130,14 +4130,10 @@ function current_language() {
     return $return;
 }
 
-/* Return the code of the current charset
- * based in some config options and the lang being used
- * caching it per request.
- * 
- * Obsoleted function.
- * 
- * @param $ignorecache to skip cached value and recalculate it again
- * @return string always returns UTF-8
+/* Obsoleted function - returns the code of the current charset - originally depended on the selected language pack.
+ *
+ * @param $ignorecache not used anymore
+ * @return string always returns 'UTF-8'
  */
 function current_charset($ignorecache = false) {
     return 'UTF-8';
@@ -5530,7 +5526,7 @@ function moodle_setlocale($locale='') {
  * @param string $encoding The encoding on the string.
  * @return string
  * @todo Add examples of calling this function with/without encoding types
- * @deprecated Use textlib->strtolower($text, current_charset()) instead.
+ * @deprecated Use textlib->strtolower($text) instead.
  */
 function moodle_strtolower ($string, $encoding='') {
     
index f640cdfb12a9e8f3e8082edf0c0ffe18ad2965d9..73a40dfa48398124931a2329f3e8630fe52c936a 100644 (file)
@@ -1152,13 +1152,9 @@ class PHPMailer
      */
     function EncodeHeader ($str, $position = 'text') {
 
-    /// Start Moodle Hack - if we are running under unicodedb, we'll try our own
-    /// encode_header code that's multibyte-safe
-        global $CFG;
-        if (!empty($CFG->unicodedb)) {
-            $textlib = textlib_get_instance();
-            return $textlib->encode_mimeheader($str, $this->CharSet);
-        }
+    /// Start Moodle Hack - do our own multibyte-safe header encoding
+        $textlib = textlib_get_instance();
+        return $textlib->encode_mimeheader($str, $this->CharSet);
     /// End Moodle Hack
       $x = 0;
       
index 074223ebfcdd29e4c39f67950a5fff1acca225d8..26de63489decdb38692781a10de74077e1b47afa 100644 (file)
@@ -321,13 +321,7 @@ function rss_full_tag($tag,$level=0,$endline=true,$content,$attributes=null) {
     global $CFG;
     $st = rss_start_tag($tag,$level,$endline,$attributes);
     $co="";
-    if (!empty($CFG->unicodedb)) {
-        // Don't perform the conversion. Contents are Unicode.
-        $co = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
-    } else {
-        // Perform the conversion. Contents aren't Unicode.
-        $co = preg_replace("/\r\n|\r/", "\n", utf8_encode(htmlspecialchars($content)));
-    }
+    $co = preg_replace("/\r\n|\r/", "\n", htmlspecialchars($content));
     $et = rss_end_tag($tag,0,true);
 
     return $st.$co.$et;
index d30a2584ddfa2d9373bdbd3086e4b8e86cbad845..ed5d8df3db3f117f27530e696f517ef8caa22200 100644 (file)
@@ -201,27 +201,10 @@ global $HTTPSPAGEREQUIRED;
         $originalconfigdebug = -1;
     }
 
-/// If $CFG->unicodedb is not set, get it from database or calculate it because we need
-/// to know it to "set names" properly.
-/// (this is the only database interaction before "set names")
-    if (!isset($CFG->unicodedb)) {
-        $utftmp = get_config('', 'unicodedb');
-        if ($utftmp !== false) {  //Only if the record exists
-        $CFG->unicodedb = $utftmp->value;
-        } else {
-            $CFG->unicodedb = setup_is_unicodedb();
-            set_config('unicodedb', $CFG->unicodedb);
-        }
-    }
-    
-/// Set the client/server and connection to utf8 if necessary
+/// Set the client/server and connection to utf8
 /// and configure some other specific variables for each db
     configure_dbconnection();
 
-/// Now that "set names" has been executed it is safe to
-/// work with the DB, but never before this!
-
-
 /// Load up any configuration from the config table
     $CFG = get_config();
 
@@ -551,7 +534,7 @@ $CFG->os = PHP_OS;
     unset($lang);
     if (empty($CFG->lang)) {
         if (empty($SESSION->lang)) {
-            $CFG->lang = !empty($CFG->unicodedb) ? 'en_utf8' : 'en';
+            $CFG->lang = 'en_utf8';
         } else {
             $CFG->lang = $SESSION->lang;
         }
@@ -638,9 +621,6 @@ $CFG->os = PHP_OS;
         }
     }
 
-/// Moodle 1.8 needs to be run on unicode, kill if not unicodedb
-    if (!$CFG->unicodedb) {
-        print_error('unicoderequired', 'admin');
-    }
-    
+/// note: we can not block non utf-8 installatrions here, because empty mysql database
+/// might be converted to utf-8 in admin/index.php during installation
 ?>
index 01a50b53bf32036cff22a8c03735163d2b5fd531..7a78e18712d9175a0e0bebeabd42f11ceeb684e8 100644 (file)
@@ -428,11 +428,11 @@ function break_up_long_words($string, $maxsize=20, $cutchar=' ') {
 
 /// Process the string adding the cut when necessary
     $output = '';
-    $length = $textlib->strlen($string, current_charset());
+    $length = $textlib->strlen($string);
     $wordlength = 0;
 
     for ($i=0; $i<$length; $i++) {
-        $char = $textlib->substr($string, $i, 1, current_charset());
+        $char = $textlib->substr($string, $i, 1);
         if ($char == ' ' or $char == "\t" or $char == "\n" or $char == "\r" or $char == "<" or $char == ">") {
             $wordlength = 0;
         } else {
@@ -2141,11 +2141,9 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
     }
 
 
-    $encoding = current_charset();
-
-    $meta = '<meta http-equiv="content-type" content="text/html; charset='. $encoding .'" />'. "\n". $meta ."\n";
+    $meta = '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'. "\n". $meta ."\n";
     if (!$usexml) {
-        @header('Content-type: text/html; charset='.$encoding);
+        @header('Content-type: text/html; charset=utf-8');
     }
 
     if ( get_string('thisdirection') == 'rtl' ) {
index e4797fd56ebac6596c41b0054f86c9300d3c78af..29ec2e7df24e815ea737738f12589a49149d02a3 100644 (file)
         error("User ID was incorrect");
     }
 
-/// Select encoding
-    $encoding = current_charset();
-
 /// Print frameset to contain all the various panes
-    @header('Content-Type: text/html; charset='.$encoding);
+    @header('Content-Type: text/html; charset=utf-8');
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
     <html>
      <head>
-       <meta http-equiv="content-type" content="text/html; charset=<?php echo $encoding ?>" />
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title><?php echo get_string('discussion', 'message').': '.fullname($user) ?></title>
      </head>
      <frameset rows="110,*,0,200" border="0" marginwidth="2" marginheight="1">
index 30da111088491c67b531b518d150038e718aaf73..aa4ecdea1ab32cf3fc849bddb2a01ab2f9675015 100644 (file)
@@ -2,9 +2,6 @@
 
     require('../config.php');
 
-/// Select encoding
-    $encoding = current_charset();
-
 /// Select direction
     if ( get_string('thisdirection') == 'rtl' ) {
         $direction = ' dir="rtl"';
         $direction = ' dir="ltr"';
     }
 /// Output the header
-    @header('Content-Type: text/html; charset='.$encoding);
+    @header('Content-Type: text/html; charset=utf-8');
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
 <html <?php echo $direction ?>>
   <head>
-    <meta http-equiv="content-type" content="text/html; charset=<?php echo $encoding ?>" />
+    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   </head>
   <body class="message course-1" id="message-messages">
index 8a3d6029070f0415f67884361280d461437e3f74..4cc0f35d10d1759cd7947b16803b6c90111deaa7 100644 (file)
@@ -14,9 +14,6 @@
         error("Messaging is disabled on this site");
     }
 
-/// Select encoding
-    $encoding = current_charset();
-
 /// Script parameters
     $userid       = required_param('id', PARAM_INT);
     $userfullname = strip_tags(required_param('name', PARAM_RAW));
 
     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
     echo '<html><head><title> </title>';
-    echo '<meta http-equiv="content-type" content="text/html; charset='.$encoding.'" />';
+    echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
     echo '<script type="text/javascript">'."\n";
     echo '<!--'."\n";
     echo 'if (parent.messages.document.getElementById("messagestarted") == null) {'."\n";
     echo '  parent.messages.document.close();'."\n";
     echo '  parent.messages.document.open("text/html","replace");'."\n";
     echo '  parent.messages.document.write("<html><head><title> <\/title>");'."\n";
-    echo '  parent.messages.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset='.current_charset().'\" />");'."\n";
+    echo '  parent.messages.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />");'."\n";
     echo '  parent.messages.document.write("<base target=\"_blank\" />");'."\n";
     echo '  parent.messages.document.write("'.addslashes($stylesheetshtml).'");'."\n";
     echo '  parent.messages.document.write("<\/head><body class=\"message course-1\" id=\"message-messages\"><div style=\"display: none\" id=\"messagestarted\">&nbsp;<\/div>");'."\n";
index 00eeb794084d29407ef13ea004b0e3eea9520755..152555bed8aaf015d8de3df9b17c1c951a37b022 100644 (file)
@@ -19,9 +19,6 @@
         $stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />';
     }
 
-/// Select encoding
-    $encoding = current_charset();
-
 /// Select direction
     if ( get_string('thisdirection') == 'rtl' ) {
         $direction = ' dir="rtl"';
         $direction = ' dir="ltr"';
     }
 
-    @header('Content-Type: text/html; charset='.$encoding);
+    @header('Content-Type: text/html; charset=utf-8');
     echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
     echo "<html $direction>\n<head>\n";
-    echo '<meta http-equiv="content-type" content="text/html; charset='.$encoding.'" />';
+    echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
     echo $stylesheetshtml;
 
 /// Script parameters
index dcbc97ef2f4f77b837baefa186e7d4fc82541083..49a136416b264f4e44c441171f713b188ac82134 100644 (file)
@@ -62,7 +62,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=<?php echo current_charset(); ?>" />
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
    <?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
   </title>
index f58b78d3aba8b63be79fe1a12a3a7f039c896e84..e372849c02429ada4860e41263409e3e11b0c799 100644 (file)
@@ -73,7 +73,7 @@
     header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
-    header('Content-Type: text/html; charset='.current_charset());
+    header('Content-Type: text/html; charset=utf-8');
     header("Refresh: $CFG->chat_refresh_room; url=$refreshurl");
 
     /// required stylesheets
@@ -90,7 +90,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
     <head>
-        <meta http-equiv="content-type" content="text/html; charset=<?php echo current_charset(); ?>" />
+        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
         <script type="text/javascript">
         <!--
         if (parent.msg.document.getElementById("msgStarted") == null) {
@@ -98,7 +98,7 @@
             parent.msg.document.open("text/html","replace");
             parent.msg.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
             parent.msg.document.write("<html><head>");
-            parent.msg.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=<?php echo current_charset(); ?>\" />");
+            parent.msg.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />");
             parent.msg.document.write("<base target=\"_blank\" />");
             parent.msg.document.write("<?php echo $stylesheetshtml ?>");
             parent.msg.document.write("</head><body class=\"mod-chat-gui_header_js course-<?php echo $chatuser->course ?>\" id=\"mod-chat-gui_header_js-jsupdate\"><div style=\"display: none\" id=\"msgStarted\">&nbsp;</div>");
index 0558cf43788e6d76b84fd97a2b9e0330717c26ba..9c4d3c7708ec02a1beb667abd81789555ed2cabe 100644 (file)
@@ -80,7 +80,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
     <head>
-        <meta http-equiv="content-type" content="text/html; charset=<?php echo current_charset(); ?>" />
+        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
         <script type="text/javascript">
         <!--
         if (parent.msg.document.getElementById("msgStarted") == null) {
@@ -88,7 +88,7 @@
             parent.msg.document.open("text/html","replace");
             parent.msg.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
             parent.msg.document.write("<html><head>");
-            parent.msg.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=<?php echo current_charset(); ?>\" />");
+            parent.msg.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />");
             parent.msg.document.write("<base target=\"_blank\" />");
             parent.msg.document.write("<?php echo $stylesheetshtml ?>");
             parent.msg.document.write("</head><body class=\"mod-chat-gui_header_js course-<?php echo $chatuser->course ?>\" id=\"mod-chat-gui_header_js-jsupdate\"><div style=\"display: none\" id=\"msgStarted\">&nbsp;</div>");
index 74504f52810699e25ec6ffc16c4078e3fc4feb5f..57b7bcd6a5921f33eaf2468c44a7afb9f8d5528c 100644 (file)
@@ -57,7 +57,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
 <html>
  <head>
-  <meta http-equiv="content-type" content="text/html; charset=<?php echo current_charset(); ?>" />
+  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
    <?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
   </title>
index ae90f92078836d68a41fdb5f2607915310f26707..5096f3be0419852b8af0f3864e30e684774c6622 100644 (file)
@@ -1803,10 +1803,6 @@ function glossary_read_imported_file($file) {
         }
         fclose($h);
     }
-    if (empty($CFG->unicodedb)) {
-        $textlib = textlib_get_instance();
-        $line = $textlib->convert($line, 'UTF-8', current_charset());
-    }
     return xmlize($line, 0);
 }
 
@@ -1835,10 +1831,6 @@ function glossary_full_tag($tag,$level=0,$endline=true,$content) {
         global $CFG;
     
         $st = glossary_start_tag($tag,$level,$endline);
-        if (empty($CFG->unicodedb)) {
-            $textlib = textlib_get_instance();
-            $content = $textlib->convert($content, current_charset(), 'UTF-8');
-        }
         $co = preg_replace("/\r\n|\r/", "\n", s($content));
         $et = glossary_end_tag($tag,0,true);
         return $st.$co.$et;
index e3745d3a87f1b2652bfe67eaec4f52456ccf6681..d99bc3abd201984817c444c5089cdf85f530bffd 100644 (file)
 
             // Setting the pivot for the current entry
             $pivot = $entry->glossarypivot;
-            $upperpivot = $textlib->strtoupper($pivot, current_charset());
+            $upperpivot = $textlib->strtoupper($pivot);
             // Reduce pivot to 1cc if necessary
             if ( !$fullpivot ) {
-                $upperpivot = $textlib->substr($upperpivot, 0, 1, current_charset());
+                $upperpivot = $textlib->substr($upperpivot, 0, 1);
             }            
             
             // If there's  group break
index 767c20bca24fc40b6d7f3aa2f1b573cce7d438ef..19b3b4779c84663aefc6a1a4635e6ca1b7b6405b 100644 (file)
@@ -85,7 +85,7 @@
         } else {
             $usernamefield = sql_fullname('u.lastname' , 'u.firstname');
         }
-        $where = "AND " . sql_substr() . "(upper($usernamefield),1," .  $textlib->strlen($hook, current_charset()) . ") = '" . $textlib->strtoupper($hook, current_charset()) . "'";
+        $where = "AND " . sql_substr() . "(upper($usernamefield),1," .  $textlib->strlen($hook) . ") = '" . $textlib->strtoupper($hook) . "'";
 
         if ( $hook == 'ALL' ) {
             $where = '';
 
         $where = '';
         if ($hook != 'ALL' and $hook != 'SPECIAL') {
-            $where = 'AND ' . sql_substr() . '(upper(concept),1,' .  $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
+            $where = 'AND ' . sql_substr() . '(upper(concept),1,' .  $textlib->strlen($hook) . ') = \'' . $textlib->strtoupper($hook) . '\'';
         }
 
         $sqlselect  = "SELECT ge.*, ge.concept AS glossarypivot";
 
         case 'letter': 
             if ($hook != 'ALL' and $hook != 'SPECIAL') {
-                $where = 'AND ' . sql_substr() . '(upper(concept),1,' .  $textlib->strlen($hook, current_charset()) . ') = \'' . $textlib->strtoupper($hook, current_charset()) . '\'';
+                $where = 'AND ' . sql_substr() . '(upper(concept),1,' .  $textlib->strlen($hook) . ') = \'' . $textlib->strtoupper($hook) . '\'';
             }
             if ($hook == 'SPECIAL') {
                 //Create appropiate IN contents
                     }
                     $sqlalphabet .= '\''.$alphabet[$i].'\'';
                 }
-                $where = 'AND ' . sql_substr() . '(upper(concept),1,1) NOT IN (' . $textlib->strtoupper($sqlalphabet, current_charset()) . ')';
+                $where = 'AND ' . sql_substr() . '(upper(concept),1,1) NOT IN (' . $textlib->strtoupper($sqlalphabet) . ')';
             }
         break;
         }
index cfd401e931f7dc3ac86d3a15dbc9b717b21a21f6..5e5b49c66d681cb0c994c399b8806dc50e4422b6 100644 (file)
 
             // Setting the pivot for the current entry
             $pivot = $entry->glossarypivot;
-            $upperpivot = $textlib->strtoupper($pivot, current_charset());
+            $upperpivot = $textlib->strtoupper($pivot);
             // Reduce pivot to 1cc if necessary
             if ( !$fullpivot ) {
-                $upperpivot = $textlib->substr($upperpivot, 0, 1, current_charset());
+                $upperpivot = $textlib->substr($upperpivot, 0, 1);
             }            
             
             // if there's a group break
index 47c60bc932d1da8e9484772843903549cfbf88f7..b34a5d1bed96a841c2d921306594b3e1ffb2bd5b 100644 (file)
@@ -13,8 +13,8 @@ function label_add_instance($label) {
     $textlib = textlib_get_instance();
 
     $label->name = addslashes(strip_tags(format_string(stripslashes($label->content),true)));
-    if ($textlib->strlen($label->name, current_charset()) > LABEL_MAX_NAME_LENGTH) {
-        $label->name = $textlib->substr($label->name, 0, LABEL_MAX_NAME_LENGTH, current_charset())."...";
+    if ($textlib->strlen($label->name) > LABEL_MAX_NAME_LENGTH) {
+        $label->name = $textlib->substr($label->name, 0, LABEL_MAX_NAME_LENGTH)."...";
     }
     $label->timemodified = time();
 
@@ -29,8 +29,8 @@ function label_update_instance($label) {
     $textlib = textlib_get_instance();
 
     $label->name = addslashes(strip_tags(format_string(stripslashes($label->content),true)));
-    if ($textlib->strlen($label->name, current_charset()) > LABEL_MAX_NAME_LENGTH) {
-        $label->name = $textlib->substr($label->name, 0, LABEL_MAX_NAME_LENGTH, current_charset())."...";
+    if ($textlib->strlen($label->name) > LABEL_MAX_NAME_LENGTH) {
+        $label->name = $textlib->substr($label->name, 0, LABEL_MAX_NAME_LENGTH)."...";
     }
     $label->timemodified = time();
     $label->id = $label->instance;
index aaa716163540e68475da65518f7676ff366c9e85..ca0d84b45ff98ed3186f659521756a7772b11f17 100644 (file)
@@ -350,12 +350,11 @@ function display() {
 
     $frameset = optional_param( 'frameset','' );
     if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame")) {
-        $encoding = current_charset();
-        @header('Content-Type: text/html; charset='.$encoding);
+        @header('Content-Type: text/html; charset=utf-8');
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
-        echo '<meta http-equiv="content-type" content="text/html; charset='.$encoding.'" />';
+        echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
         echo "<title>{$course->shortname}: ".strip_tags(format_string($resource->name,true))."</title></head>\n";
         echo "<frameset rows=\"$CFG->resource_framesize,*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" />";
index d3c67b1e85de789ce737feebd2a168c7c288c1cd..e07610e904b3a4a325014cf6a271166338faa6a3 100644 (file)
@@ -35,9 +35,6 @@
 /// fast forward to first non-index page
     while (empty($items[$page]->href)) $page++;
     
-/// Select encoding
-    $encoding = current_charset();
-
 /// Select direction
     if (get_string('thisdirection') == 'rtl') {
         $direction = ' dir="rtl"';
             if (!is_object($item)) {
                 continue;
             }
-        /// Convert text from UTF-8 to current charset if needed
-            if (empty($CFG->unicodedb)) {
-                $textlib = textlib_get_instance();
-                $item->title = $textlib->convert($item->title, 'UTF-8', current_charset());
-            }
         /// Skip pages until we arrive to $page
             if ($item->id < $page) {
                 continue;
index 25c2fb990fba1f1b51d3ee9a28efe172048d8f3d..cf4a0565bcb8c2651b0629cf1e14ba1ca5da94bc 100644 (file)
@@ -537,9 +537,6 @@ class resource_ims extends resource_base {
             }
         }
 
-    /// Select encoding
-        $encoding = current_charset();
-    
     /// print navigation buttons if needed  
         if (!empty($this->parameters->navigationbuttons)) {
             $this->print_nav($items, $resource, $page);
@@ -759,11 +756,6 @@ class resource_ims extends resource_base {
             if (!is_object($item)) {
                 continue;
             }
-        /// Convert text from UTF-8 to current charset if needed
-            if (empty($CFG->unicodedb)) {
-                $textlib = textlib_get_instance();
-                $item->title = $textlib->convert($item->title, 'UTF-8', current_charset());
-            }
         /// Skip pages until we arrive to $page
             if ($item->id < $page) {
                 continue;
index c4774c299d64b30347b70ca68607d9fa654ecd1b..b8682de4f61bc8a1ef12a1d56c76d1b9c135240a 100644 (file)
@@ -293,31 +293,7 @@ class xml2Array {
        $values = array();
        $lookingfor = 1;
 
-       if (empty($CFG->unicodedb)) {  // If Unicode DB support enable does not convert string
-           $textlib = textlib_get_instance();
-           for ($i = 0; $i < $textlib->strlen($str,'utf-8'); $i++) {
-               $thisvalue = ord($str[$i]);
-               if ($thisvalue < 128) {
-                   $entities .= $str[$i]; // Leave ASCII chars unchanged 
-               } else {
-                   if (count($values) == 0) {
-                       $lookingfor = ($thisvalue < 224) ? 2 : 3;
-                   }
-                   $values[] = $thisvalue;
-                   if (count($values) == $lookingfor) {
-                       $number = ($lookingfor == 3) ?
-                           (($values[0] % 16) * 4096) + (($values[1] % 64) * 64) + ($values[2] % 64):
-                           (($values[0] % 32) * 64) + ($values[1] % 64);
-                       $entities .= '&#' . $number . ';';
-                       $values = array();
-                       $lookingfor = 1;
-                   }
-               }
-           }
-           return $entities;
-       } else {
-           return $str;
-       }
+       return $str;
    }
 
    /**
index eb26420e27589ca4edb7c20932c65aa155d073fd..b1bc4bfdedb21b0b2bd71f5bb9bd2691e705726e 100644 (file)
@@ -39,7 +39,6 @@
     /// Now check whether we need to display a frameset
 
     if (empty($frameset)) {
-        $encoding = current_charset();
         if ( get_string('thisdirection') == 'rtl' ) {
             $direction = ' dir="rtl"';
         } else {
@@ -47,7 +46,7 @@
         }
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html $direction>\n";
-        echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=$encoding\" />\n";
+        echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n";
         echo "<title>{$course->shortname}: ".format_string($workshop->name,true)."</title></head>\n";
         echo "<frameset rows=\"50%,*\" border=\"10\">";
         echo "  <frame src=\"assess.php?id=$id&amp;sid=$sid&amp;frameset=top&amp;redirect=$redirect\" border=\"10\" />";
index f840c2ed00bd5a11f27036c47a604c9ae9f6c5d8..3290c73550749223bb93f97fdc670c31f8837bb2 100644 (file)
@@ -38,7 +38,6 @@
     /// Now check whether we need to display a frameset
 
     if (empty($frameset)) {
-        $encoding = current_charset();
         if ( get_string('thisdirection') == 'rtl' ) {
             $direction = ' dir="rtl"';
         } else {
@@ -46,7 +45,7 @@
         }
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html $direction>\n";
-        echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=$encoding\" />\n";
+        echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n";
         echo "<title>{$course->shortname}: ".format_string($workshop->name,true)."</title></head>\n";
         echo "<frameset rows=\"90%,*\" border=\"10\">";
         echo "  <frame src=\"viewassessment.php?id=$id&amp;aid=$aid&amp;allowcomments=$allowcomments&amp;frameset=top&amp;redirect=$redirect\" border=\"10\" />";
index bcbdf2014a88ecb29d279d3c7b918f4d12768063..1fb2e32586a5a19aab2f56dd3de7bb91c1669153 100644 (file)
@@ -492,10 +492,6 @@ class hotpot_xml_tree {
         } else {
             // encode htmlentities in JCloze
             $this->encode_cdata($str, 'gap-fill');
-            // encode as utf8
-            if (empty($CFG->unicodedb)) {
-                $str = utf8_encode($str);
-            }
             // xmlize (=convert xml to tree)
             $this->xml =  xmlize($str, 0);
         }
@@ -507,9 +503,6 @@ class hotpot_xml_tree {
         eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
 
         if (is_string($value)) {
-            if (empty($CFG->unicodedb)) {
-                $value = utf8_decode($value);
-            }
 
             // decode angle brackets and ampersands
             $value = strtr($value, array('&#x003C;'=>'<', '&#x003E;'=>'>', '&#x0026;'=>'&'));
index 208e39c17892741cf1400f828b51001a6de4d3c0..8c11892a1eed717ba27d305e918cd920fa9fd8d3 100644 (file)
@@ -380,11 +380,7 @@ function handle_questions_media(&$questions, $path, $courseid) {
         $smarty->assign('course', $course);
         $smarty->assign('lang', $this->lang);
         $expout = $smarty->fetch('imsmanifest.tpl');
-        if (!empty($CFG->unicodedb)) {
-            echo $expout;
-        } else {
-            echo utf8_encode($expout);
-        }
+        echo $expout;
         return true;
     }
 
index 6bf6efa9406d56168144e3478d78e48dbe501e24..60f9c0f55731deb43e307692049fe5375766553a 100644 (file)
@@ -137,7 +137,7 @@ if (has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SI
     choose_from_menu ($choices, "mailformat", $user->mailformat, "") ?>
     </td>
 </tr>
-<?php if (!empty($CFG->unicodedb) && !empty($CFG->allowusermailcharset)) { ?>
+<?php if (!empty($CFG->allowusermailcharset)) { ?>
 <tr>
     <th><?php print_string("emailcharset") ?>:</th>
     <td><?php
@@ -148,7 +148,7 @@ if (has_capability('moodle/user:update', get_context_instance(CONTEXT_SYSTEM, SI
         if (!empty($CFG->sitemailcharset)) {
             $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')';
         } else {
-            $choices['0'] = get_string('default').' ('.current_charset().')';
+            $choices['0'] = get_string('default').' (UTF-8)';
         }
         $choices = array_merge($choices, $charsets);
         choose_from_menu($choices, 'mailcharset', $mailcharset, ''); ?>
index 918532854823c8c0ff3215750619d986275e138f..7f0033ddc0af347466f797ae548f86ebfcb87388 100644 (file)
         
         $usernew->maildisplay   = clean_param($usernew->maildisplay,   PARAM_INT);
         $usernew->mailformat    = clean_param($usernew->mailformat,    PARAM_INT);
-        if (!empty($CFG->unicodedb) && $CFG->allowusermailcharset) {
+        if ($CFG->allowusermailcharset) {
             $usernew->mailcharset = clean_param($usernew->mailcharset, PARAM_CLEAN);
             if (!empty($usernew->mailcharset)) {
                 set_user_preference('mailcharset', $usernew->mailcharset, $user->id);