Moodle

data mapping

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Duplicate
  • Affects Version/s: 1.6.3, 1.7
  • Fix Version/s: 1.8
  • Component/s: Authentication
  • Labels:
    None
  • Environment:
    linux - mysql
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_16_STABLE, MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE

Description

using external authentication, data mapping is not working well with text like (n with tilde) ñ

mysql is set to UTF-8 likewise the external db...

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

To be fixed in 1.8

Show
Petr Škoda (skodak) added a comment - To be fixed in 1.8
Hide
Genner Cerna added a comment -

hope this will be fix before moodle 1.7 will be out. thanks

Show
Genner Cerna added a comment - hope this will be fix before moodle 1.7 will be out. thanks
Hide
Genner Cerna added a comment -

corrected code bellow:

foreach ($fields as $field) {
if ($pcfg["field_map_$field"]) {
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(utf8_encode($rs->fields[0]))); } else { $result["$field"] = addslashes(stripslashes(utf8_encode($rs->fields[0]))); } }
}
}
}
}

return $result;
}

Show
Genner Cerna added a comment - corrected code bellow: foreach ($fields as $field) { if ($pcfg["field_map_$field"]) { 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(utf8_encode($rs->fields[0]))); } else { $result["$field"] = addslashes(stripslashes(utf8_encode($rs->fields[0]))); } } } } } } return $result; }
Hide
Martín Langhoff added a comment -

Genner – looking at the 1.7/1.8 code, I think what we have is correct. There must be something odd in your setup. Can you tell us more about the Moodle database and the external database? What DBs are they? (both mysql? version?) Are you using unicode/utf-8 mode in Moodle?

What are the encodings of the 2 databases? Specially the external database – it sounds like the ext DB has the wrong charset.

Show
Martín Langhoff added a comment - Genner – looking at the 1.7/1.8 code, I think what we have is correct. There must be something odd in your setup. Can you tell us more about the Moodle database and the external database? What DBs are they? (both mysql? version?) Are you using unicode/utf-8 mode in Moodle? What are the encodings of the 2 databases? Specially the external database – it sounds like the ext DB has the wrong charset.
Hide
Genner Cerna added a comment -

both in mysql and utf-8

correct code:

foreach ($fields as $field) {
if ($pcfg["field_map_$field"]) {
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(utf8_encode($rs->fields[0]))); } else { $result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0]))); }
}
}
}
}

return $result;
}

Show
Genner Cerna added a comment - both in mysql and utf-8 correct code: foreach ($fields as $field) { if ($pcfg["field_map_$field"]) { 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(utf8_encode($rs->fields[0]))); } else { $result["$field"] = addslashes(stripslashes(utf8_decode($rs->fields[0]))); } } } } } return $result; }
Hide
Martin Dougiamas added a comment -

Is this the same as MDL-5277 ?

Show
Martin Dougiamas added a comment - Is this the same as MDL-5277 ?
Hide
Genner Cerna added a comment -

I think it's the same with problem of MDL-5277.

Hope there's a better way to solve this problem.

Show
Genner Cerna added a comment - I think it's the same with problem of MDL-5277. Hope there's a better way to solve this problem.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: