# Unicode (Russian) username validation fails randomly

**URL:** https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637
**Category:** Translations
**Created:** [December 11, 2019, 10:17am UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637 "2019-12-11T10:17:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [December 11, 2019, 10:17am UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/1 "2019-12-11T10:17:26Z")

</div>

Usernames with Russian characters, e.g. `фыв` (not sure if depends on specific characters) sometimes fail validation.

Tested in latest Chrome and Firefox on Ubuntu 19.10, Discourse version is 2.4.0.beta8 (16de46f8d4).

 ![Peek 2019-12-11 11-46](https://global.discourse-cdn.com/meta/original/3X/5/c/5cd1f5eebca585880b29c0bb2c1a6e54fcf2b803.gif)

The HTTP request seems to be always the same for these 3 characters, reproduced by repeating multiple times in DevTools Console:

```js
fetch('/u/check_username?username=%D1%84%D1%8B%D0%B2&email=', {headers: {'X-Requested-With': 'XMLHttpRequest'}}).then(r => r.json()).then(console.log)

```

Tried to set the unicode whitelist `[йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёЁ]`, no effect.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 11, 2019, 11:37pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/2 "2019-12-11T23:37:38Z")

</div>

@gerhard any idea what is going on here? Is our Russian regex incorrect?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [December 12, 2019, 1:37pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/3 "2019-12-12T13:37:31Z")

</div>

I can’t reproduce the issue. Any chance that you entered some kind of invisible whitespace or something like that when it showed you the “must only include numbers, letters, dashes, dots, and underscores” error message?

The username check runs on the server, so if there was a problem with the regex, it should always generate the same results for the same input.

---

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [December 12, 2019, 2:49pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/4 "2019-12-12T14:49:20Z")

</div>

> [@gerhard](#):
>
> The username check runs on the server, so if there was a problem with the regex, it should always generate the same results for the same input.

Yes, that’s why it’s strange.

I thought that it could be related to some kind of rate limiting, but now I got the error even after a long pause (2 minutes) on the first request, and then success on the third request in several seconds.

> [@gerhard](#):
>
> Any chance that you entered some kind of invisible whitespace or something like that when it showed you the “must only include numbers, letters, dashes, dots, and underscores” error message?

I can reproduce it executing the code above in DevTools.

 ![Peek 2019-12-12 16-42](https://global.discourse-cdn.com/meta/original/3X/d/7/d72324ce538a7e9dd27e0d77a088535ed564474a.gif)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [December 12, 2019, 3:28pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/5 "2019-12-12T15:28:17Z")

</div>

I’m still not able to reproduce the issue. Could you please try to disable and reenable the `unicode usernames` site setting? Maybe a unicorn worker didn’t get the memo that the setting changed. That would explain why only some of the requests result in an error. If that doesn’t help, try rebuilding the app container.

---

<div class="post-metadata">

### Author: ![Alex\_P](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_p/32/163548_2.png) [@Alex\_P](https://meta.discourse.org/u/Alex_P)
#### Post date: [December 16, 2019, 4:07pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/6 "2019-12-16T16:07:30Z")

</div>

> [@gerhard](#):
>
> Could you please try to disable and reenable the `unicode usernames` site setting?

It didn’t help, but yes, I cannot reproduce it too in my [local Docker instance](https://meta.discourse.org/t/beginners-guide-to-install-discourse-for-development-using-docker/102009) and looks like it disappeared after restart when upgrading Discourse.

btw if anyone is looking for a simpler way to whitelist Russian letters, looks like this regex works: `[\p{Cyrillic}]`

---

<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: [October 4, 2023, 6:00pm UTC](https://meta.discourse.org/t/unicode-russian-username-validation-fails-randomly/135637/7 "2023-10-04T18:00:53Z")

</div>


