Skip to content

fix: using UTF8 without quoted#14

Closed
Itsusinn wants to merge 3 commits intoEasterGhost:masterfrom
Itsusinn:fix/utf8-argument
Closed

fix: using UTF8 without quoted#14
Itsusinn wants to merge 3 commits intoEasterGhost:masterfrom
Itsusinn:fix/utf8-argument

Conversation

@Itsusinn
Copy link
Copy Markdown

Brigadier 的 StringArgumentType.string() 在解析非引号字符串时只允许 [0-9A-Za-z_\-.+],无引号的中文字符不在允许范围内。
因此在本pr之前 /setwarp 你好 会导致错误。我创建了一个工具类更换了参数解析器,让此语法合法

@Itsusinn Itsusinn marked this pull request as draft March 30, 2026 03:39
intercept ArgumentTypeRegistry.registerArgumentType()
@Itsusinn Itsusinn marked this pull request as ready for review March 30, 2026 03:58
@EasterGhost
Copy link
Copy Markdown
Owner

EasterGhost commented Mar 31, 2026

It ought to be known that non-ASCII character is not allowed to appear in command line unless it is content of a string. An anti-pattern modification will not be merged in master branch because it conflicts with the coding standards. If quotes are not enforced, when players input some invisible characters or special Unicode space characters (e.g. Ideographic Space,U+3000, or Non-breaking Space,U+00A0), the custom while (peek() != ' ') logic may fail, causing commands to execute with unexpected errors.

It seems to say that why I have to type /home rather than /家 to execute "teleport home" command. It is ridiculous and unreasonable.

I understand that non-native English speakers might be more inclined to use their native language rather than English when naming a waypoint, but this non-ASCII name has to be an explicit string enclosed in quotes. The only time it is fixed is when Mojang supports multi-language parsing.

If I consider adding a multi-language version, I will reconsider your pr, but it will never be merged in master branch. Thanks for your contribution.

@EasterGhost
Copy link
Copy Markdown
Owner

EasterGhost commented Apr 1, 2026

I should inform you that I fully support the use of UTF-8/UTF-32 encoding. However, Mojang/Fabric doesn't support then I don't support. This ought to be implemented by Mojang/Fabric official or any other mod rather than me. This is a technology boundary that we have to adhere to.

In the total design of this mod, I did not enforce the use of ASCII. Instead, as you can see, I prefer UTF-8 to deal with my waypoint name's storage and make an effort to do some i18n. I wish the Unicode support can be implemented asap so all mods can deal with non-ASCII characters easily.

About the "anti-pattern": This does not mean a pattern that goes against modern CLI design. It just goes against Mojang/Fabric's design. I ‘m in favor of phasing out this outdated pattern but this is not something that this mod should do.

BTW, why don't you design a mod that mix in this brigadier? It must be popular among non-English speaking players especially Chinese players.

You can refer Unicode-Arguments to check out.

@Itsusinn
Copy link
Copy Markdown
Author

Itsusinn commented Apr 1, 2026

Mojang or Microsoft just don't give a care about community Mojang/brigadier#145 .
Anyway I am tired of this chore, no more unicode things

@Itsusinn Itsusinn deleted the fix/utf8-argument branch April 1, 2026 04:53
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.

2 participants