# 你可以允许在用户名中使用表情符号吗

**URL:** <https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990>\
**Category:** Support\
**Created:** [2024年五月30日 15:47 UTC](https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990 "2024-05-30T15:47:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![a\_lilian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/a_lilian/32/452643_2.png) [@a\_lilian](https://meta.discourse.org/u/a_lilian)\
**Post date:** [2024年五月30日 15:47 UTC](https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990/1 "2024-05-30T15:47:49Z")

</div>

你好！我的网站用户希望在他们的用户名中使用表情符号，我正在尝试了解这是否对他们来说是可能的。我找到了允许你拓宽用户名 Unicode 选项的设置：

> [@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) …

但据我所知，它似乎不适用于表情符号。这里有两种情况，一种是如我所料的，一种是不如我所料的：

## 情况 1 - 如预期般工作 ✅

允许使用 Unicode 用户名，允许使用某些非 ASCII Unicode 字符：

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/8/a/68a3823c41f533df716af33820d841426fb84391.png)

结果是接受了使用这些字符的用户名：

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/2/3/b23495578dd9da5a0d152b491f097df037219d2b.png)

## 情况 2 - 未如预期般工作 ❌

允许使用 Unicode 用户名，允许使用特定的表情符号字符：

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/a/7/fa7b8a73443fb7c7bfe1a82f472c4fc0426a5295.png)

但使用允许字符的用户名不被接受：

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/2/9/12920890ad64dcfb132f583f14147ad87ff10064.png)

如果我将 `allowed unicode username characters` 留空，即允许所有字符而不进行正则表达式白名单过滤，我也会得到相同的结果。

## 我的问题：

是否可以在用户名中允许使用表情符号？

---

<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:** [2024年五月31日 07:31 UTC](https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990/2 "2024-05-31T07:31:23Z")

</div>

不行，用户名中不允许使用表情符号。它们不被视为字母。

> [@gerhard](#):
>
> 默认情况下，Discourse 允许字母（[Ll](https://www.compart.com/en/unicode/category/Ll) / [Lm](https://www.compart.com/en/unicode/category/Lm) / [Lo](https://www.compart.com/en/unicode/category/Lo) / [Lt](https://www.compart.com/en/unicode/category/Lt) / [Lu](https://www.compart.com/en/unicode/category/Lu)）、标记（[Mc](https://www.compart.com/en/unicode/category/Mc)、[Me](https://www.compart.com/en/unicode/category/Me)、[Mn](https://www.compart.com/en/unicode/category/Mn)）和数字（[Nd](https://www.compart.com/en/unicode/category/Nd)、[Nl](https://www.compart.com/en/unicode/category/Nl)），但_不允许_ [No](https://www.compart.com/en/unicode/category/No)。该设置可以限制这些字符，但无法允许其他字符。

---

<div class="post-metadata">

**Author:** ![a\_lilian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/a_lilian/32/452643_2.png) [@a\_lilian](https://meta.discourse.org/u/a_lilian)\
**Post date:** [2024年六月1日 22:36 UTC](https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990/3 "2024-06-01T22:36:54Z")

</div>

唉。好吧，谢谢你的回答！

---

<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:** [2024年七月1日 22:37 UTC](https://meta.discourse.org/t/can-you-allow-emoji-in-usernames/309990/4 "2024-07-01T22:37:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
