User_name_suggester will become buggy when in non-english version discourse

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

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:


hmmmm I am wondering no one knows about this?

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.