# Dropped special characters in usernames

**URL:** https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378
**Category:** Support
**Created:** [August 10, 2019, 2:33am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378 "2019-08-10T02:33:24Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [August 10, 2019, 2:33am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/1 "2019-08-10T02:33:24Z")

</div>

On our main site there are often people who use underscores and dashes in usernames. When they are ported to our Discourse forum, one or more of those characters is often dropped from the username, resulting in a mismatch.

The forum is provided for the site users only and being able to correlate between the usernames is important.

Examples:  
kayakaya\_ becomes kayakaya  
\_\_aena13 becomes \_aena13

At present we haven’t figured out how to either automatically delete or disable forum accounts when the mains are closed or at least generate a report. Is that possible?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 10, 2019, 2:39am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/2 "2019-08-10T02:39:07Z")

</div>

The usernames are being auto-edited to reflect the Discourse rules for usernames.

---

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [August 10, 2019, 2:41am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/3 "2019-08-10T02:41:40Z")

</div>

That’s pretty much what I figured. Thankfully we have found a place that keeps the _actual_ username intact.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 10, 2019, 2:44am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/4 "2019-08-10T02:44:59Z")

</div>

We recently added two site settings which allow you to permit more characters in the username

> [@Unicode usernames and group names](https://meta.discourse.org/t/unicode-usernames-and-group-names/117737):
>
> Lifting the restrictions on allowed characters in usernames is one of the oldest feature requests. Starting with Discourse 2.3.0.beta9 it’s finally possible to use Unicode characters within usernames and group names. New Site Settings There are two new site settings: allowed unicode username characters and unicode usernames. allowed unicode username characters allows you to allow only certain Unicode characters (e.g. [äöüßÄÖÜẞ] or \p{Greek}). By default Discourse permits letters ([Ll](https://www.compart.com/en/unicode/category/Ll) …

Did you try tweaking those?

---

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [August 10, 2019, 2:46am UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/5 "2019-08-10T02:46:27Z")

</div>

We’ll take a look at that and see if it helps. Thank you.

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [February 3, 2020, 4:51pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/6 "2020-02-03T16:51:08Z")

</div>

We are seeing this too with SSO as well with usernames being converted.

I have mentioned this [here](https://meta.discourse.org/t/unicode-usernames-and-group-names/117737/18), but this topic is more recent — maybe someone can take a look.

With the introduction of the Unicode support for usernames/groups, it is now possible to have usernames like `中国` (which is awesome!) but Discourse doesn’t allow usernames to start/end with a dash (but, eg, underscore is fine).

Is there a reason for preventing dashes in the first/last position? Any chance this policy can be revised if there’s no obvious downside to it? /cc @Falco

---

<div class="post-metadata">

### Author: ![Kat\_F](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kat_f/32/161990_2.png) [@Kat\_F](https://meta.discourse.org/u/Kat_F)
#### Post date: [February 3, 2020, 4:54pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/7 "2020-02-03T16:54:27Z")

</div>

It does get difficult when users put in a special character because the username they want is taken.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 3, 2020, 4:54pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/8 "2020-02-03T16:54:43Z")

</div>

You can try overwriting those rules in a custom plugin and living with it for a few weeks. If it shows no problems in normal Discourse usage, send a pull request.

---

<div class="post-metadata">

### Author: ![mentalstring](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalstring/32/168934_2.png) [@mentalstring](https://meta.discourse.org/u/mentalstring)
#### Post date: [February 25, 2020, 8:57pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/9 "2020-02-25T20:57:59Z")

</div>

I’m having a go at this and managed to get leading/trailing dashes on usernames working fine, including on mentions.

Not so lucky with the underscore at start+end of a username because on the message composer the markdown parser seems to have precedence before the @ mentions: the username gets rendered in italic instead of a link.

I’m a bit stuck at the moment on that as I’m not sure where to look to address this. Any tip @Falco?

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 4, 2024, 12:15pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/10 "2024-02-04T12:15:37Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [February 4, 2024, 12:40pm UTC](https://meta.discourse.org/t/dropped-special-characters-in-usernames/125378/11 "2024-02-04T12:40:45Z")

</div>


