$SESSION->justloggedin = true;
unset($SESSION->lang);
- unset($SESSION->encoding);
- $SESSION->encoding = current_charset();
// Restore the calendar filters, if saved
if (intval(get_user_preferences('calendar_persistflt', 0))) {
if (!detect_munged_arguments($lang, 0) and (file_exists($CFG->dataroot .'/lang/'. $lang) or
file_exists($CFG->dirroot .'/lang/'. $lang))) {
$SESSION->lang = $lang;
- $SESSION->encoding = get_string('thischarset');
}
}
if (empty($CFG->lang)) {
if (!empty($CFG->courselang)) {
moodle_setlocale();
}
- $SESSION->encoding = $encoding;
$meta = '<meta http-equiv="content-type" content="text/html; charset='. $encoding .'" />'. "\n". $meta ."\n";
if (!$usexml) {
/// Configure links behaviour
$fullurl = $CFG->wwwroot.'/mod/resource/view.php?r='.$resource->id.'&frameset=ims&page=';
- /// Decide if we have to leave text in UTF-8, else convert to ISO-8859-1
- /// (interim solution until everything was migrated to UTF-8). Then we'll
- // delete this hack.
- $convert = true;
- if ($SESSION->encoding == 'UTF-8') {
- $convert = false;
- }
-
/// Iterate over items to build the menu
$currlevel = 0;
$currorder = 0;
$endlevel = 0;
foreach ($items as $item) {
- /// Convert text to ISO-8859-1 if specified (will remove this once utf-8 migration was complete- 1.6)
- if ($convert) {
- $item->title = utf8_decode($item->title);
- }
-
+ /// 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;