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

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


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.

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,

Complete thread:

 RSS Feed of thread

powered by my little forum