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

Improper handling of newline \n characters in JSON components for item names and lores

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 1.20.4, 24w09a, 24w10a
    • None
    • Java 21, Windows 11
    • Community Consensus
    • Commands, Text

      The newline character in JSON components is not properly handled by the client. Instead of displaying a line break, a line feed symbol is shown. This issue was resolved in MC-39987 for chat messages, but it persists for item names and lore. It's expected that the client interprets the newline \n character as a line break.

      To reproduce this issue in 1.20.4, use the following command:

      /give @s stone{display:{Name:"{\"text\":\"line 1\\nline 2\"}", Lore:["{\"text\":\"line 1\\nline 2\"}"]}}

      for 24w09a+:

      /give @s minecraft:stone[minecraft:custom_name="{\"text\":\"line 1\\nline 2\"}",minecraft:lore=["{\"text\":\"line 1\\nline 2\"}"]]

      Bedrock edition handles newline characters correctly, displaying the text as intended on separate lines.

      Fixing this issue would significantly benefit translations, especially since some languages require more space than others. Additionally, it would eliminate the need for multiple translation keys "line1", "line2", etc., just to achieve proper text wrapping.

        1. 2024-03-02_13.22.16.png
          184 kB
          kelianor
        2. bedrock_behaviour.png
          6 kB
          userb
        3. WAWM43vFS3.png
          31 kB
          userb

            Unassigned Unassigned
            userb userb
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: