From: skodak Date: Sat, 11 Nov 2006 17:23:20 +0000 (+0000) Subject: we are going 100% unicode now - removed use of $CFG->unicodedb and current_charset... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=810944af7f3aed4ff4d38aa283b89fe36f9a0766;p=moodle.git we are going 100% unicode now - removed use of $CFG->unicodedb and current_charset(); MDL-7439 - part 2, only hotpot and wiki left --- diff --git a/admin/cron.php b/admin/cron.php index b890c35cdf..568f4c2443 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -55,11 +55,11 @@ /// 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 ""; //<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 diff --git a/admin/index.php b/admin/index.php index 010ed90465..26fb7c96eb 100644 --- a/admin/index.php +++ b/admin/index.php @@ -145,7 +145,9 @@ 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")) { diff --git a/admin/settings/server.php b/admin/settings/server.php index a634dc4fa0..dab850f24a 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -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); diff --git a/admin/xmldb/actions/test/test.class.php b/admin/xmldb/actions/test/test.class.php index 8c9067e75a..2eaedfbd21 100644 --- a/admin/xmldb/actions/test/test.class.php +++ b/admin/xmldb/actions/test/test.class.php @@ -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); diff --git a/auth/db/lib.php b/auth/db/lib.php index 153192b809..f8e78f0a6a 100644 --- a/auth/db/lib.php +++ b/auth/db/lib.php @@ -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])); } } } diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php index ccf96dfe90..88947eda9b 100644 --- a/auth/ldap/lib.php +++ b/auth/ldap/lib.php @@ -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; } } } diff --git a/auth/shibboleth/lib.php b/auth/shibboleth/lib.php index b63e2615b8..038fd1dfa5 100755 --- a/auth/shibboleth/lib.php +++ b/auth/shibboleth/lib.php @@ -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 diff --git a/backup/backuplib.php b/backup/backuplib.php index 5633189b24..ac5f62db08 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -435,13 +435,7 @@ //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; } diff --git a/backup/lib.php b/backup/lib.php index d28e2c1a61..c98f3203a5 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -531,13 +531,7 @@ //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 diff --git a/backup/restorelib.php b/backup/restorelib.php index 60da142d17..19af8e50ec 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -346,7 +346,7 @@ //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! } @@ -3016,13 +3016,7 @@ //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") diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index e0bde3a3b8..6841dffb3d 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -168,7 +168,7 @@ 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); @@ -275,11 +275,11 @@ /// 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).'...'; } } } diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index 54864d6f21..01950c1824 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -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 } diff --git a/config-dist.php b/config-dist.php index 1552736892..86d15ea0bd 100644 --- a/config-dist.php +++ b/config-dist.php @@ -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 diff --git a/enrol/paypal/enrol.php b/enrol/paypal/enrol.php index fcf5f04557..ae596231fa 100644 --- a/enrol/paypal/enrol.php +++ b/enrol/paypal/enrol.php @@ -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; } diff --git a/lib/ddllib.php b/lib/ddllib.php index d290e969b9..860aed6753 100644 --- a/lib/ddllib.php +++ b/lib/ddllib.php @@ -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(); } } diff --git a/lib/dmllib.php b/lib/dmllib.php index cb22c699e7..78893cdac4 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -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': diff --git a/lib/excellib.class.php b/lib/excellib.class.php index 9d07f2823a..04403403a3 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -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); } diff --git a/lib/filelib.php b/lib/filelib.php index b5d02b556d..641f2c762f 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -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 diff --git a/lib/filterlib.php b/lib/filterlib.php index fec3a7f9d1..e7eb25d330 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -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 diff --git a/lib/graphlib.php b/lib/graphlib.php index 4feb2ce73b..6c79f3478a 100644 --- a/lib/graphlib.php +++ b/lib/graphlib.php @@ -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); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 532d5e6e11..e494b1d461 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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='') { diff --git a/lib/phpmailer/class.phpmailer.php b/lib/phpmailer/class.phpmailer.php index f640cdfb12..73a40dfa48 100644 --- a/lib/phpmailer/class.phpmailer.php +++ b/lib/phpmailer/class.phpmailer.php @@ -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; diff --git a/lib/rsslib.php b/lib/rsslib.php index 074223ebfc..26de63489d 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -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; diff --git a/lib/setup.php b/lib/setup.php index d30a2584dd..ed5d8df3db 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -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 ?> diff --git a/lib/weblib.php b/lib/weblib.php index 01a50b53bf..7a78e18712 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -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' ) { diff --git a/message/discussion.php b/message/discussion.php index e4797fd56e..29ec2e7df2 100644 --- a/message/discussion.php +++ b/message/discussion.php @@ -21,16 +21,13 @@ 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"> diff --git a/message/messages.php b/message/messages.php index 30da111088..aa4ecdea1a 100644 --- a/message/messages.php +++ b/message/messages.php @@ -2,9 +2,6 @@ require('../config.php'); -/// Select encoding - $encoding = current_charset(); - /// Select direction if ( get_string('thisdirection') == 'rtl' ) { $direction = ' dir="rtl"'; @@ -12,11 +9,11 @@ $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"> diff --git a/message/refresh.php b/message/refresh.php index 8a3d602907..4cc0f35d10 100644 --- a/message/refresh.php +++ b/message/refresh.php @@ -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)); @@ -34,14 +31,14 @@ 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"; diff --git a/message/send.php b/message/send.php index 00eeb79408..152555bed8 100644 --- a/message/send.php +++ b/message/send.php @@ -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"'; @@ -29,10 +26,10 @@ $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 diff --git a/mod/chat/gui_header_js/index.php b/mod/chat/gui_header_js/index.php index dcbc97ef2f..49a136416b 100644 --- a/mod/chat/gui_header_js/index.php +++ b/mod/chat/gui_header_js/index.php @@ -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> diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index f58b78d3ab..e372849c02 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -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>"); diff --git a/mod/chat/gui_header_js/jsupdated.php b/mod/chat/gui_header_js/jsupdated.php index 0558cf4378..9c4d3c7708 100644 --- a/mod/chat/gui_header_js/jsupdated.php +++ b/mod/chat/gui_header_js/jsupdated.php @@ -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>"); diff --git a/mod/chat/gui_sockets/index.php b/mod/chat/gui_sockets/index.php index 74504f5281..57b7bcd6a5 100644 --- a/mod/chat/gui_sockets/index.php +++ b/mod/chat/gui_sockets/index.php @@ -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> diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index ae90f92078..5096f3be04 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -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; diff --git a/mod/glossary/print.php b/mod/glossary/print.php index e3745d3a87..d99bc3abd2 100644 --- a/mod/glossary/print.php +++ b/mod/glossary/print.php @@ -153,10 +153,10 @@ // 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 diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 767c20bca2..19b3b4779c 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -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 = ''; @@ -105,7 +105,7 @@ $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"; @@ -235,7 +235,7 @@ 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 @@ -247,7 +247,7 @@ } $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; } diff --git a/mod/glossary/view.php b/mod/glossary/view.php index cfd401e931..5e5b49c66d 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -336,10 +336,10 @@ // 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 diff --git a/mod/label/lib.php b/mod/label/lib.php index 47c60bc932..b34a5d1bed 100644 --- a/mod/label/lib.php +++ b/mod/label/lib.php @@ -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; diff --git a/mod/resource/type/file/resource.class.php b/mod/resource/type/file/resource.class.php index aaa7161635..ca0d84b45f 100644 --- a/mod/resource/type/file/resource.class.php +++ b/mod/resource/type/file/resource.class.php @@ -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\" />"; diff --git a/mod/resource/type/ims/preview.php b/mod/resource/type/ims/preview.php index d3c67b1e85..e07610e904 100644 --- a/mod/resource/type/ims/preview.php +++ b/mod/resource/type/ims/preview.php @@ -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"'; @@ -89,11 +86,6 @@ 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; diff --git a/mod/resource/type/ims/resource.class.php b/mod/resource/type/ims/resource.class.php index 25c2fb990f..cf4a0565bc 100644 --- a/mod/resource/type/ims/resource.class.php +++ b/mod/resource/type/ims/resource.class.php @@ -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; diff --git a/mod/scorm/datamodels/scormlib.php b/mod/scorm/datamodels/scormlib.php index c4774c299d..b8682de4f6 100644 --- a/mod/scorm/datamodels/scormlib.php +++ b/mod/scorm/datamodels/scormlib.php @@ -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; } /** diff --git a/mod/workshop/assess.php b/mod/workshop/assess.php index eb26420e27..b1bc4bfded 100644 --- a/mod/workshop/assess.php +++ b/mod/workshop/assess.php @@ -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\" />"; diff --git a/mod/workshop/viewassessment.php b/mod/workshop/viewassessment.php index f840c2ed00..3290c73550 100644 --- a/mod/workshop/viewassessment.php +++ b/mod/workshop/viewassessment.php @@ -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\" />"; diff --git a/question/format/hotpot/format.php b/question/format/hotpot/format.php index bcbdf2014a..1fb2e32586 100644 --- a/question/format/hotpot/format.php +++ b/question/format/hotpot/format.php @@ -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;'=>'&')); diff --git a/question/format/qti2/format.php b/question/format/qti2/format.php index 208e39c178..8c11892a1e 100644 --- a/question/format/qti2/format.php +++ b/question/format/qti2/format.php @@ -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; } diff --git a/user/edit.html b/user/edit.html index 6bf6efa940..60f9c0f557 100644 --- a/user/edit.html +++ b/user/edit.html @@ -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, ''); ?> diff --git a/user/edit.php b/user/edit.php index 9185328548..7f0033ddc0 100644 --- a/user/edit.php +++ b/user/edit.php @@ -104,7 +104,7 @@ $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);