Skip to content

Commit 2959776

Browse files
authored
[Social SDK] New How-To section + Handling special characters in Display Names guide (discord#7621)
* Added Social SDK How To categry * Add handling special characters * refer to character handling in UFL design guide * Reorder and drop numbers. Not in ranked order
1 parent 8e9bd1c commit 2959776

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

docs/discord-social-sdk/design-guidelines/unified-friends-list.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ It's also **scalable** and **inclusive** of provisional accounts who do not have
6565

6666
When referring to a player's Discord Identity, please use their **Discord Display Name**, and not their username.
6767

68+
:::info
69+
See [How to Manage Special Characters in Discord Display Names](/docs/discord-social-sdk/how-to/handle-special-characters-display-names) for guidance on handling special characters in text chat and friend lists.
70+
:::
71+
6872
![Discord display names](images/social-sdk/design-guidelines/UFL-07.png)
6973

7074
## Scaling to Multiple Platforms

docs/discord-social-sdk/how-to.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
sidebar_label: How To
3+
showTOC: false
4+
subpages:
5+
- how-to/handle-special-characters-display-names.mdx
6+
---
7+
8+
[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > How To
9+
10+
# Discord Social SDK How To Guides
11+
12+
These how-to guides offer common solutions for integrating Discord Social SDK features into your game.
13+
14+
<Container>
15+
<Card title="Handle Special Characters in Display Names" link="/docs/discord-social-sdk/how-to/handle-special-characters-display-names" icon="LettersIcon">
16+
Handling Unicode characters in Discord Display Names for your game's chat and friend lists.
17+
</Card>
18+
</Container>
19+
20+
---
21+
22+
## Change Log
23+
24+
| Date | Changes |
25+
|---------------|-----------------------|
26+
| June 17, 2025 | added How To category |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
sidebar_label: Handle Special Characters in Display Names
3+
---
4+
5+
[Home](/docs/intro) > [Discord Social SDK](/docs/discord-social-sdk/overview) > [How To](/docs/discord-social-sdk/how-to) > {sidebar_label}
6+
7+
# How To {sidebar_label}
8+
9+
The Social SDK [recommends](https://discord.com/developers/docs/discord-social-sdk/development-guides/creating-a-unified-friends-list#step-1-fetch-relationships) using an account's [Display Name](https://discord.com/developers/docs/slayer-sdk/classdiscordpp_1_1UserHandle.html#af6447fa2011bfa4fcd7e55bc56847f5c) in the Unified Friends List. However, Display Names support a large set of characters across the Unicode spec, and some of these characters may not be supported in a game's specified font.
10+
11+
There are several options to address this:
12+
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
24+
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.
26+
27+
**Tradeoffs:**
28+
29+
- This may result in unintended transliterations. It is impossible to create a perfect mapping between Unicode and ASCII in every situation. Libraries try their best, but this approach may unintentionally create an inaccurate or even offensive display name in some instances.
30+
- Libraries will not have 100% coverage. Some Unicode characters may not have a map to an ASCII character. If someone's Display Name is `ʕ•͡-•ʔ` what would it map to?
31+
- Similarly, most libraries assume English is the target language.
32+
- Users may not appreciate their display names being changed without their knowledge or consent.
33+
34+
35+
## Use the Discord Username as a Fallback
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).
38+
39+
**Tradeoffs:**
40+
41+
- This can break immersion in a game if a friend had expected to rely on their Display Name from within the game.
42+
- Some users consider their Username to be more private information and do not expect it to be shared by others (such as when someone is streaming and their friends list is visible).
43+
44+
---
45+
46+
## Change Log
47+
48+
| Date | Changes |
49+
|---------------|---------------------------------|
50+
| June 17, 2025 | special characters how-to added |

0 commit comments

Comments
 (0)