mojira.dev
MC-269003

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

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.

Linked issues

Attachments

Comments 8

Can confirm, here is an updated command for 24w09a

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

It also seems to affect painting size tooltip, when using belarusian language.

[media]

Confirmed in 24w10a

I have attached the expected behaviour which can be seen in the bedrock edition.

Thank you for your report!
After consideration, the issue is being closed as Won't Fix.

Please note that this is not the same as Working as Intended, as this bug report correctly describes behavior in the game that might not be the intended or desirable behavior, but it will not be fixed right now. Sometimes, this is because the issue reported is minor and/or impossible to change without large architectural changes to the code base.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

I find it quite disappointing that this issue won't be addressed, especially considering its benefits and the parity mismatch. I would have thought now would be the best of times to fix it, given the current significant efforts being made to rework items. It's unfortunate that such valid concerns are not being resolved at this time. Additionally, the absence of a specified timeframe for when, or if, this might be reconsidered only adds to the frustration. Importantly, the fact that this issue has been reported multiple times indicates a persistent demand for a fix from the community, highlighting not just a recurring problem but a clear desire for resolution.

The incorrect handling of newline characters in item names and lores may seem minor to the development team and most players, however, it poses a significant barrier to those aiming to support accessibility and inclusivity through resource packs, whether that be for a mod, a map or a server. Although this issue primarily impacts creators, its ripple effect hinders the broader goal of ensuring the game is inclusive for the diverse community of players we want to include into our creations. As I mentioned in my issue, this complicates translations and forces creators into cumbersome workarounds, ultimately limiting the game's accessibility and inclusivity on a global scale.
 

⚠️ Please do not add Affected Versions to resolved reports.

Have a look at the Resolution and the comments to see why this ticket has been resolved. If you think this ticket has been resolved erroneously you can contact the Mojira staff on Discord or Reddit.

-- I am a bot. This action was performed automatically! If you think it was incorrect, please notify us on Discord or Reddit

Userb, sorry for a very late reply, but if you want for your issue to be reopened you can join the Mojira discord server, select the java edition project in role selection channel and post a request to reopen the issue in java requests channel 🙂.

userb

(Unassigned)

Community Consensus

Commands, Text

1.20.4, 24w09a, 24w10a

Retrieved