# Unicode usernames

**URL:** <https://meta.discourse.org/t/unicode-usernames/277878>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [September 5, 2023, 4:50pm UTC](https://meta.discourse.org/t/unicode-usernames/277878 "2023-09-05T16:50:44Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [September 5, 2023, 7:17pm UTC](https://meta.discourse.org/t/unicode-usernames/277878/4 "2023-09-05T19:17:07Z")

</div>

> [@zengyunsi](#):
>
> in the programming software it is not ok

What are you using? The error looks like python? This is supported by `requests` but possibly not by the libraries you’re using.

```python
In [1]: import requests

In [2]: api_key = '«redacted»'

In [3]: r = requests.get('https://try.discourse.org/u/运思/notifications.json', headers = {
  'api-key': api_key,
  'api-username': '运思'.encode()
})

In [4]: r.status_code
Out[4]: 200

In [5]: r.json()['users'][0]
Out[5]: 
{'id': 41,
 'username': '运思',
 'name': 'Michael Brown',
 'avatar_template': '/user_avatar/try.discourse.org/运思/{size}/208_2.png',
 'trust_level': 1,
 'assign_icon': 'user-plus',
 'assign_path': '/u/运思/activity/assigned'}

```

Try calling `.encode()` to explicitly convert the header value to `bytes`… though admittedly since not everything is 8-bit clean I do agree this suggestion:

> [@zengyunsi](#):
>
> add a judgment, if not found, try to decodeURI, match the username

is reasonable.

---

_[View the full topic](https://meta.discourse.org/t/unicode-usernames/277878)._
