You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/discord-social-sdk/how-to/handle-special-characters-display-names.mdx
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,17 @@ The Social SDK [recommends](https://discord.com/developers/docs/discord-social-s
10
10
11
11
There are several options to address this:
12
12
13
-
## 1. Map the Unicode characters to ASCII
13
+
## Use a font family that supports Unicode
14
+
15
+
A family such as [Noto](https://notofonts.github.io/) aims to have broad Unicode support. If a font cannot render a Display Name, consider rendering it with a fallback font, or in the extreme case, choose a font with broad Unicode support for the Friends List.
16
+
17
+
**Tradeoffs:**
18
+
19
+
- One font family may not include 100% overlap with what Discord supports.
20
+
- A font that supports Unicode may not mesh with your game's aesthetics.
21
+
- Engine support is limited, especially for characters that rely on UTF surrogate pairs.
22
+
23
+
## Map the Unicode characters to ASCII
14
24
15
25
A library such as [Unidecode](https://metacpan.org/pod/Text::Unidecode) (which has been ported to many different languages) can map many Unicode characters to an ASCII equivalent. If you detect that a Display Name has characters that cannot be rendered, consider passing it through a library to transliterate the Display Name to ASCII.
16
26
@@ -21,17 +31,8 @@ A library such as [Unidecode](https://metacpan.org/pod/Text::Unidecode) (which h
21
31
- Similarly, most libraries assume English is the target language.
22
32
- Users may not appreciate their display names being changed without their knowledge or consent.
23
33
24
-
## 2. Use a font family that supports Unicode
25
-
26
-
A family such as [Noto](https://notofonts.github.io/) aims to have broad Unicode support. If a font cannot render a Display Name, consider rendering it with a fallback font, or in the extreme case, choose a font with broad Unicode support for the Friends List.
27
-
28
-
**Tradeoffs:**
29
-
30
-
- One font family may not include 100% overlap with what Discord supports.
31
-
- A font that supports Unicode may not mesh with your game's aesthetics.
32
-
- Engine support is limited, especially for characters that rely on UTF surrogate pairs.
33
34
34
-
## 3. Use the Discord Username as a Fallback
35
+
## Use the Discord Username as a Fallback
35
36
36
37
If a Display Name is not renderable at all, consider falling back to the user's [`Username`](https://discord.com/developers/docs/slayer-sdk/classdiscordpp_1_1UserHandle.html#a0eda41fe18b50bce373fb5a1b88cb411).
0 commit comments