mojira.dev
MC-252987

Illegal character '\n' in text component clickEvent

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.

 

Attachments

Comments 0

No comments.

Legopitstop

gegy

Confirmed

Normal

Social Interactions

1.19, 22w24a

1.19.1 Release Candidate 1

Retrieved