User_name_suggester will become buggy when in non-english version discourse

AI-generated summary

The User_name_suggester feature in non-English Discourse versions is experiencing issues. lisbethw1130 reported a bug where anonymous usernames become random hexadecimal strings or “111” in Traditional Chinese versions. This occurs when the sanitize_username method removes non-English characters, resulting in an empty string that gets filled with “1” by rightsize_username. lisbethw1130 suggests using Pinyin to sanitize non-English usernames instead. However, gerhard notes that Unicode username support is planned for version 2.3, and gerhard later mentions that this issue was fixed in May as part of the Unicode Usernames and Group Names feature.

Hi, this is Lisbeth from Taiwan.
We use Traditional Chinese version discourse here, and we found this bug when our anonymous username become random hex which looks creepy for friendly users LOL.

Our first 100 anonymous username are something like 1111, 1112…111100, after 111100, it will become random hex.

So I keep digging the source code, and see that anonymous user name use a user_name_suggester.suggest, it will put Anonymous in Chinese (匿名) these two words into the suggester, when it go through sanitize_username, everything will be blank

Example:
sanitize_username(‘匿名’) ===> “”

then when “” go through rightsize_username, it will fill least username with 1, and become 111

I believe most non-english version discourse is suffering in this situation, when we use SSO login, if the username is non-english, this will happen, too.

Probably solution: if the username come from SSO isn’t English or create anonymous user, when go through user_name_suggester.sanitize_username, consider using pinyin (Pinyin - Wikipedia) or something instead of 111 or random hex which is really creepy LOL

Any idea is welcome :slight_smile:

4 Likes

hmmmm I am wondering no one knows about this?

1 Like

It looks like we will be adding support for Unicode usernames in version 2.3 which should solve this problem. There’s already an open pull request for it.

6 Likes

This was fixed in May by introducing Unicode usernames and group names.

6 Likes