Warning: Non-US characters in user name (General)

by danielb987, Tuesday, April 18, 2017, 12:43 (8 days ago)

Hello,

I have a Swedish forum there some of the users have Swedish characters in their user names. I have now noticed that if two users have user names that looks alike but are different, they will not be able to login.

Example:
One user has the user name "daniel" and the other user has the user name "däniel".

The mysql database thinks that this is the same user name, which means that a database search on one of these user names will result in two rows. But My Little Forum requires that only one single user has a particular user name.

I think MySQL has changed how the database thinks of this sometimes in the past. Maybe it's due to the transition to UTF-8 that causes this but I'm not sure. My forum has had a very old version of My Little Forum until a month ago and when I did the upgrade, the tables where changed to UTF-8.

I suggest that the field "user_name" should have a unique index, but if doing so, we might have other forums with duplicate user names.

There is a simple way to see if this is a problem. This SQL query will show any dublicate user names. If there is any dublicate user names in the database, these users will not be able to log in to the forum.

SELECT `user_name`, COUNT(`user_name`) FROM `mlf2_userdata` GROUP BY `user_name` HAVING COUNT(`user_name`) > 1

If an upgrade script is adding a uniqe index to a text field in the database, I strongly recommends that the query above is used before to check if the field is uniqe. It is much better to get an error before the upgrade script does any changes than to get the error in the middle of the upgrade.

Best regards,
Daniel

Avatar

Warning: Non-US characters in user name

by Auge ⌂ @, Tuesday, April 18, 2017, 15:01 (8 days ago) @ danielb987
edited by Auge, Wednesday, April 19, 2017, 09:41

Hello

I have a Swedish forum there some of the users have Swedish characters in their user names. I have now noticed that if two users have user names that looks alike but are different, they will not be able to login.

Example:
One user has the user name "daniel" and the other user has the user name "däniel".

I can confirm this misbehaviour in one of <del>my accessible</del> servers <ins>I have access to</ins>. The reason is the use of the collation utf8_general*. A blog entry (in german language) offers a solution, the use of the collation utf8_bin. But this has the same issues like your unique index and has to be implemented equally careful.

Tschö, Auge

--
further development of mlf1

Warning: Non-US characters in user name

by danielb987, Tuesday, April 18, 2017, 16:46 (8 days ago) @ Auge
edited by Auge, Wednesday, April 19, 2017, 09:42

Hello

I have a Swedish forum there some of the users have Swedish characters in their user names. I have now noticed that if two users have user names that looks alike but are different, they will not be able to login.

Example:
One user has the user name "daniel" and the other user has the user name "däniel".


I can confirm this misbehaviour in one of <del>my accessible</del> servers <ins>I have access to</ins>. The reason is the use of the collation utf8_general*. A blog entry (in german language) offers a solution, the use of the collation utf8_bin. But this has the same issues like your unique index and has to be implemented equally careful.

Tschö, Auge

In the case with the user name, it is a problem. But in general I think this is a very useful feature. For example, a danish user may search for a word with the letter Ø then the word contains the Swedish letter Ö.

Best regards
Daniel

Avatar

Warning: Non-US characters in user name

by Auge ⌂ @, Wednesday, April 19, 2017, 09:44 (7 days ago) @ danielb987

Hello

I have a Swedish forum there some of the users have Swedish characters in their user names. I have now noticed that if two users have user names that looks alike but are different, they will not be able to login.


I can confirm this misbehaviour in one of <del>my accessible</del> servers <ins>I have access to</ins>. The reason is the use of the collation utf8_general*. A blog entry (in german language) offers a solution, the use of the collation utf8_bin.


In the case with the user name, it is a problem. But in general I think this is a very useful feature. For example, a danish user may search for a word with the letter Ø then the word contains the Swedish letter Ö.

It should be no problem to only change the collation of fields, where it is necessary. :-)

Tschö, Auge

--
further development of mlf1

RSS Feed of thread
powered by my little forum