Username completition broken for names with accents like Régis

AI-generated summary

A bug was reported where the username completion feature in Discourse does not work with names containing accents. rriemann pointed out that users with names like Régis cannot be found by typing @ followed by Ré. sam noted that this issue likely affects users with non-ASCII characters in their names, such as Chinese users. fantasticfears initially agreed to fix the issue, but rriemann later followed up, providing a potential solution using Rails’ I18n.transliterate helper.

After some development updates, rriemann reported that the issue was still present and linked to a related topic. However, zogstrip later confirmed that the issue had been fixed by eviltrout. The fix allows for correct username completion with accented characters, as demonstrated by a successful search for @régis.

Hello,

In my forum, people have real names with all different kind of accents. I tried to use the username completition launched by typing @ to mention a user while writing a response and found that I could not find users by their name if the name contains an é.

You can test it on your own. Try to find @zogstrip by typing @ followed by Ré for Régis. The actual username lookup is https://meta.discourse.org/u/search/users?term=r&topic_id=65888&include_groups=true. Note that all characters from the e with accent on are stripped off from the search query.

3 „Gefällt mir“

I assume it is a similar issue for Chinese @fantasticfears ? Do you want to take sorting this out?

4 „Gefällt mir“

Sure, I’ll take a look into this.

4 „Gefällt mir“

In Europe, we have quite a few countries with numerous non-ASCII first and lastnames: Máté,
Zétény, Márton, Clémence, Léonie, Aïcha, etc.

So if for instance our German and English speaking forum users try to find or tag those people without having these accents on their keyboard, one might believe the database is incomplete. They just don’t appear if you type the first few letters.

tl;dr: Having this working is really important for regions with more heterogeneous character sets.

Rails should have some helpers therefore:

1.9.3p392 :001 > require "i18n"
 => true
1.9.3p392 :002 > I18n.transliterate("Hé les mecs!")
 => "He les mecs!"
1 „Gefällt mir“

Any news? :slightly_smiling_face:

Should be close. Once some code is swept, it will come to alive :slight_smile:

4 „Gefällt mir“

Related commit:

https://github.com/discourse/discourse/pull/4974

2 „Gefällt mir“

I found a related topic:

The bug can still be reproduced. Régis cannot be tagged if you know not his lastname or his username @zogstrip. :frowning:

This works now. @eviltrout fixed it recently :+1:

And the request is

https://meta.discourse.org/u/search/users?term=r%C3%A9gis&topic_id=65934&include_mentionable_groups=true
5 „Gefällt mir“