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 ![]()
Raising it to critical.
Adding some auth gurus here. In case I get 3 positives, I'll apply it both to 1.7 and HEAD. If somebody can imagine any combination where it won't work, please....tell about.
Ciao