Mojira Archive
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.

 

Fixed

Legopitstop

[Mojang] Gegy

2022-06-13, 05:39 PM

2022-06-29, 01:56 PM

2022-06-22, 01:46 PM

3

3

Confirmed

Normal

Social Interactions

1.19, 22w24a

1.19.1 Release Candidate 1