Mojira Archive
MC-90726

NBT data as command output has incomplete String escaping

Introduction

When a command modifies or for some commands also not modifies the NBT data of an entity or a block, the chat shows the current NBT data.

The bug

I noticed a bug after recompiling Minecraft 1.8 using MCP which is still present in the latest version. When the toString() method of a NBTTagString is called, it only replaces double quotes (") with escaped double quotes (\").
This can cause problems as the output is supposed to represent the correct NBT data of an object. As it is missing the backslash escaping it would cause two backslashes to become one.

For 1.9 see null's comment

How to reproduce

  1. Use the following command:
    /summon armor_stand ~ ~ ~ {CustomName:"\"\\a"}
    
  2. Use the following command:
    /entitydata @e[type=armor_stand,c=1] {CustomNameVisible:1b}
    

The output probably shows something like this:

...CustomName:"\"\a"...

But as you see that was not what you entered.

Fixed

Marcono1234

[Mojang] Grum (Erik Broes)

2015-10-16, 12:42 AM

2017-07-21, 02:38 PM

2017-07-21, 02:37 PM

4

6

Confirmed

NBT, escape, escaping, feedback, output, string

Minecraft 15w42a - Minecraft 17w17aMinecraft 15w42a, Minecraft 15w45a, Minecraft 16w42a, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w15a, Minecraft 17w16a, Minecraft 17w16b, Minecraft 17w17a

Minecraft 1.12