Skip to content

fix: properly encode unicode codepoints outside BMP#497

Merged
vberlier merged 2 commits intomcbeet:mainfrom
MineRobber9000:proper-encode
Feb 15, 2026
Merged

fix: properly encode unicode codepoints outside BMP#497
vberlier merged 2 commits intomcbeet:mainfrom
MineRobber9000:proper-encode

Conversation

@MineRobber9000
Copy link
Copy Markdown
Contributor

The BMP (Basic Multilingual Plane) consists of all Unicode codepoints from U+0000 to U+FFFF. For characters in the BMP, you can encode them with a \uXXXX escape in both JSON and SNBT. However, characters outside of the BMP are encoded differently. In SNBT, you can use \Uxxxxxxxx (\U followed by 8 hex characters); in JSON, you need to encode them as UTF-16 surrogates. With this change, mecha can now properly encode these characters.

Fixes #496.

@rx-dev rx-dev self-requested a review January 30, 2026 18:43
@rx-dev
Copy link
Copy Markdown
Member

rx-dev commented Jan 30, 2026

https://github.com/TheShulkerBox/shulker/blob/main/src/game/duels/instance.bolt#L40-L48

tried with this with a fork, didn't seem to change anything

team add duels.team_1 "Duels Team 1"
team add duels.team_2 "Duels Team 2"
team modify duels.team_1 friendlyFire false
team modify duels.team_1 prefix "\u1f5e1 "
team modify duels.team_1 seeFriendlyInvisibles false
team modify duels.team_2 friendlyFire false
team modify duels.team_2 prefix "\u1f5e1 "
team modify duels.team_2 seeFriendlyInvisibles false

@MineRobber9000
Copy link
Copy Markdown
Contributor Author

It works on my end? Make sure you're installing specifically mecha from the fork (pip install C:\path\to\beet\packages\mecha).

image

MineRobber9000 and others added 2 commits February 16, 2026 00:50
The BMP (Basic Multilingual Plane) consists of all Unicode codepoints from
U+0000 to U+FFFF. For characters in the BMP, you can encode them with a
`\uXXXX` escape in both JSON and SNBT. However, characters outside of the BMP
are encoded differently. In SNBT, you can use `\Uxxxxxxxx` (`\U` followed by
8 hex characters); in JSON, you need to encode them as UTF-16 surrogates. With
this change, mecha can now properly encode these characters.

Fixes mcbeet#496.
@vberlier vberlier merged commit 858018a into mcbeet:main Feb 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unicode codepoints outside of the Basic Multilingual Plane are incorrectly encoded

4 participants