Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-252987

Illegal character '\n' in text component clickEvent


    • Confirmed
    • Social Interactions
    • Normal

      If a run_command click event that has a new character ( \n ) causes the player to get kicked from the world and displays the `Illegal characters in chat` screen


      Steps to Reproduce:

      1. Create a singleplayer world (make sure to enable cheats).
      2. Paste the following command into the chat. Then press enter. 
        /tellraw @s [{"text":"Click me!","clickEvent": {"action":"run_command","value": "/tellraw @s [{\"text\":\"Players:\n\"},{\"color\":\"gray\",\"selector\":\"@a\"}]"} }]
      1. Open chat and press `Click me!`

      Observed Results:

      • The world closes and displays the `Connection lost, Illegal characters in chat` screen after pressing the text.
      • Removing the `\n` character from the run command event causes the command to run.
      • Double escaping the new line character seems to fix it. 
        /tellraw @s [{"text":"Click me!","clickEvent": {"action":"run_command","value": "/tellraw @s [{\"text\":\"Players:\\n\"},{\"color\":\"gray\",\"selector\":\"@a\"}]"} }]
      • Putting the new line character in the main tellraw command properly works. 
        /tellraw @s {"text":"Hello\nWorld"}

      Expected Results:

      • The click event properly runs the tellraw command and displays all active players.


            gegy1000 [Mojang] Gegy
            Legopitstop Legopitstop
            3 Vote for this issue
            3 Start watching this issue