//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 {
//This function is used to get the current contents property value
//They are trimed (and converted from utf8 if needed)
function getContents() {
- if (current_charset() != 'UTF-8') {
+ global $CFG;
+
+ if (empty($CFG->unicodedb)) {
return trim(utf8_decode($this->content));
} else {
return trim($this->content);