mojira.dev
MCPE-121996

Command Block UTF-8 slicing error

Steps to Reproduce:

1) Paste this command into a command block

/kill @e[name=§9§lDiscord Kit]

2) Place a button on the command block and press it

3) Right click on the command block and view the previous output field

 

Observed Results:{*}*

Previous output field will look like this

Syntax error: Unexpected "Kit": at

 

Expected Results:

Previous output field should look like this with colour formatting

Syntax error: Unexpected "Kit": at "Discord >>Kit<<]"

 

The string after `at` is just the symptom of a larger issue. The reason it can't be displayed is because the code to crop the string splits a character in half making an invalid UTF-8 string that cannot be displayed. This invalid string also gets saved to the game files.

 

Extended Details:

The `§` character is encoded as `\xC2\xA7` as is correctly saved in the `Command` field but when the `LastOutputParams` field is created instead of treating these two bytes as one character like they are they are treated as two individual bytes. This leads to the result of `\xA7lDiscord ` which the game tries to interpret but it is invalid so it is not able to. If sliced correctly it would look like `\xC2\xA7lDiscord ` and would be able to be displayed.

This result is also saved to disk in the `LastOutputParams` field.

 

Here is the binary NBT of the `LastOutputParams` if it helps debug the issue.

`09 10 00 4C 61 73 74 4F 75 74 70 75 74 50 61 72 61 6D 73 08 03 00 00 00 0A 00 A7 6C 44 69 73 63 6F 72 64 20 03 00 4B 69 74 01 00 5D`

Comments 3

Is this still an issue in the latest version? If so, can you add it to the affected versions?

The issue still exists in the 1.16.230.54 beta but it isn't a version I can choose from

Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response

Is this still an issue in the latest version? If so, please add a comment or update the affected version field.

To make your bug report as effective as possible, please try and include the following steps to reproduce the problem:

Steps to Reproduce:
1.
2.
3.

Observed Results:
(Briefly describe what happens)

Expected Results:
(Briefly describe what should happen)

If your ticket does not look like the example given here, then it's likely to be closed as incomplete.

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

gentlegiantJGC

(Unassigned)

704635

Plausible

Windows

Windows 10

1.18.0.27 Beta, 1.16.210, 1.16.221 Hotfix

Retrieved