Last modified: 2010-05-15 15:59:48 UTC
Created attachment 4569 [details]
A quick patch to fix this.
When a user whose name contain UTF8-encoded characters, tries to log in, PostgreSQL complains of illegal characters in the query. For example, user name "Pertti Höytylä", UTF8 encoding in hex "5065727474692048c3b67974796cc3a4", causes this error.
A database error has occurred Query: UPDATE mwuser SET user_touched = 'xxx' WHERE user_id = '1122' Function: User::invalidateCache Error: 1 ERROR: invalid byte sequence for encoding "UTF8": 0xc32e HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
The problem is in includes/Database.php, where the user name put in the SQL query comment after being truncated to 15 bytes (in the encoded form). Sometimes this breaks in the mmiddle of UTF8 characters and causes invalid encoding which is not acceptable by PostgreSQL backend. Truncation should be done in UTF8-aware way.
Made a fix in r30536, please test it out.