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

Problem with DB authentication and Unicode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.7.1, 1.8
    • Fix Version/s: 1.8
    • Component/s: Authentication
    • Labels:
      None
    • Database:
      MySQL, PostgreSQL
    • Affected Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Tester:
              Nobody Nobody
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                31/Mar/07