/// 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
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")) {
'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);
$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;
$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',
$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);
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]));
}
}
}
$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;
}
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;
}
}
}
$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
//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;
}
//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
//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")
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).'...';
}
}
}
if (!defined('MAGPIE_OUTPUT_ENCODING')) {
- define('MAGPIE_OUTPUT_ENCODING', current_charset()); // see bug 3107
+ define('MAGPIE_OUTPUT_ENCODING', 'utf-8'); // see bug 3107
}
// $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
//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;
}
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();
}
}
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':
/// 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);
}
$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);
}
}
@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
}
}
- $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
}
// 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);
// 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);
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');
}
}
// 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)) {
$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
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';
* @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='') {
*/
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;
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;
$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();
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;
}
}
}
-/// 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
?>
/// 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 {
}
- $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' ) {
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">
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">
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\"> <\/div>");'."\n";
$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
<!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>
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
<!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) {
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\"> </div>");
<!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) {
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\"> </div>");
<!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>
}
fclose($h);
}
- if (empty($CFG->unicodedb)) {
- $textlib = textlib_get_instance();
- $line = $textlib->convert($line, 'UTF-8', current_charset());
- }
return xmlize($line, 0);
}
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;
// 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
} 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;
}
// 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
$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();
$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;
$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}&type={$resource->type}&frameset=top\" />";
/// 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;
}
}
- /// Select encoding
- $encoding = current_charset();
-
/// print navigation buttons if needed
if (!empty($this->parameters->navigationbuttons)) {
$this->print_nav($items, $resource, $page);
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;
$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;
}
/**
/// Now check whether we need to display a frameset
if (empty($frameset)) {
- $encoding = current_charset();
if ( get_string('thisdirection') == 'rtl' ) {
$direction = ' dir="rtl"';
} else {
}
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&sid=$sid&frameset=top&redirect=$redirect\" border=\"10\" />";
/// Now check whether we need to display a frameset
if (empty($frameset)) {
- $encoding = current_charset();
if ( get_string('thisdirection') == 'rtl' ) {
$direction = ' dir="rtl"';
} else {
}
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&aid=$aid&allowcomments=$allowcomments&frameset=top&redirect=$redirect\" border=\"10\" />";
} 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);
}
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('<'=>'<', '>'=>'>', '&'=>'&'));
$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;
}
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
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, ''); ?>
$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);