Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-8479

Problem with DB authentication and Unicode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 1.8
    • 1.7.1, 1.8
    • Authentication
    • None
    • MySQL, PostgreSQL
    • MOODLE_17_STABLE, MOODLE_18_STABLE
    • MOODLE_18_STABLE

      When using db authentication, by default Moodle connects under iso-8859-1 charset. This causes that retrieved data from external DB is iso-8859-1. And such data (fistname, lastname...) is discarded on insert if Moodle is running under UTF-8.

      So the actual situation is that DB authentication with non-ASCII characters is only working if Moodle is running in NON-UNICODE mode (then such retrieved data is perfectly inserted).

      With more and more Moodle sites running under Unicode, this is really an ugly problem. Luckly it has a SIMPLE solution:

      1) Always stabilise the authdb channel to be UTF-8. This will cause retrieved data to arrive always in UTF-8 (no matter of the authdb real encoding, both drivers will perform the needed conversions automatically). (That's the attached patch).
      2) Some lines below, data will be converted back to ISO-8859-1 for Moodle running in NON-UNICODE mode (this part of code currently exists).

      Note that this will fix the problem under MySQL and PostgreSQL (where we can stabilise the communication channel). MSSQL and Oracle auth-dbs are required to run under UTF-8.

      Please, take a look to the simple patch. I've tested it both against iso-8859-1 and utf-8 autdbs and under iso-8859-1 and utf-8 moodle dbs. Seems to support all the combinations.

      Ciao

        1. lib.php.patch
          1.0 kB
          Eloy Lafuente (stronk7)

            skodak Petr Skoda
            stronk7 Eloy Lafuente (stronk7)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.