Chat converting NBSP (non-breaking space) to space causes glitches
When non-breaking space characters (U+00A0) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
#####abc creates a lot of spaces before the chat message "abc"(Since sometime between 17w06a and 17w15a, Minecraft now removes NBSPs at the beginning of the message)- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
/**
* Process chat messages (broadcast back to clients) and commands (executes)
*/
public void processChatMessage(CPacketChatMessage packetIn)
{
// ...
else
{
this.playerEntity.markPlayerActive();
String s = packetIn.getMessage();
s = StringUtils.normalizeSpace(s); // <- here
// ...
}
}
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
Environment
Operating System: Mac OS X (x86_64) version 10.11.2
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 619978928 bytes (591 MB) / 920649728 bytes (878 MB) up to 920649728 bytes (878 MB)
JVM Flags: 3 total; -Xms1G -Xmx1G -Xmn512M
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
Launched Version: 15w51b
LWJGL: 2.9.2
OpenGL: AMD Radeon R9 M290 OpenGL Engine GL version 2.1 ATI-1.40.15, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
- Cannot Reproduce
nullJames (inactive)
- 6
- 9
- Community Consensus
- (Unassigned)
- chat non-breaking-space space
1.8.9 - 1.16.5
1.8.9 15w51b 1.9 1.9.1-pre3 1.9.1 1.9.2 16w14a 16w15b 1.9.3-pre1 1.9.3-pre3 1.9.4 16w20a 16w21a 16w21b 1.10-pre1 1.10-pre2 1.10 1.10.1 1.10.2 16w35a 16w40a 1.11 1.11.2 17w06a 17w15a 1.12-pre6 1.12-pre7 1.12 1.12.1-pre1 17w43a 17w43b 17w45b 18w03b 18w11a 18w21b 1.13-pre2 1.13-pre3 1.13 18w30b 1.13.1 18w43c 18w45a 19w07a 1.14-pre2 1.14.1-pre1 19w37a 1.16.4 1.16.5
Created Issue:
Chat converting NBSP (non-breaking space) to space causes glitches
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Environment
Mac OS X 10.11.2
Mac OS X 10.11.2
Mac OS X 10.11.2
(See crash for more details)
A comment with security level 'global-moderators' was removed.
Mac OS X10.11.2
(See crash for more details)Operating System: Mac OS X (x86_64) version 10.11.2
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 619978928 bytes (591 MB) / 920649728 bytes (878 MB) up to 920649728 bytes (878 MB)
JVM Flags: 3 total; -Xms1G -Xmx1G -Xmn512M
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
Launched Version: 15w51b
LWJGL: 2.9.2
OpenGL: AMD Radeon R9 M290 OpenGL Engine GL version 2.1 ATI-1.40.15, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Operating System: Mac OS X (x86_64) version 10.11.2
Java Version: 1.8.0_60, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 619978928 bytes (591 MB) / 920649728 bytes (878 MB) up to 920649728 bytes (878 MB)
JVM Flags: 3 total; -Xms1G -Xmx1G -Xmn512M
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
Launched Version: 15w51b
LWJGL: 2.9.2
OpenGL: AMD Radeon R9 M290 OpenGL Engine GL version 2.1 ATI-1.40.15, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
Copy-pastingnon-breaking space characters (or using Opt-Space on a Mac)intochatcauses them to be convertedintonormal spaces when the chat message is sent. However, this can cause bugsasthey can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Example 1:
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Example 1:
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Example 1:
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A7', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A
7', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A
7) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A0) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A0) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
- #####abc creates a lot of spaces before the chat message "abc"
- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
When non-breaking space characters (U+00A0) are sent in chat, they are converted to space characters. However, spaces are cleaned up (removed at the beginning and end, etc.) before this conversion, meaning that NBSPs can be used to bypass it.
Examples: ("#" means a NBSP character)
- a##########b##########c creates a lot of spaces between a, b, and c
#####abc creates a lot of spaces before the chat message "abc"(Since sometime between 17w06a and 17w15a, Minecraft now removes NBSPs at the beginning of the message)- # creates a "blank" chat message containing only a space
The cause
Decompiled via MCP 9.24 beta:
net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage)/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by first replacing all NBSP with spaces via s.replace('\u00A0', ' ') (though it is kind of hacky), or by using their own pattern instead of Apache's WHITESPACE_PATTERN.
Original description
Copy-pasting non-breaking space characters (or using Opt-Space on a Mac) into chat causes them to be converted into normal spaces when the chat message is sent. However, this can cause bugs as they can be stringed together to create multiple spaces in a row, something that is not possible with regular spaces. Also, this can be used to send "blank" chat messages (only a space).
A way to fix:
It seems to me that the game first changes all double-spaces to single space characters, then checks if the message is empty, and then converts non-breaking spaces to spaces.
To fix the issue, the game should first convert non-breaking spaces to spaces, then change double-spaces to single spaces and check if the message is empty.
Possibly not a minecraft bug, see this comment.
relates to
relates to
relates to
relates to
Context
No-Break Space (NBSP, U+00A0) and Narrow No-Break Space (NNBSP, U+202F) are characters that are used in some language in place of regular space for typographic reasons. For instance, they are used in french, around some punctuation characters and as thousands separator in big numbers, to avoid automatic line break.
Issue
1. Rendering
EDIT: The rendering issue has been fixed in 23w17a due to the update of unifont into the game. Tests performed on version 1.20-pre4 (see provided screenshots) shows that the rendering issue is fixed in regular Minecraft font and when unicode font is forced.
2. "No-break" behaviour
The NBSP character does not have its "no-break" behaviour when used in chat messages and other situations. Tests performed on version 1.20-pre4 (see provided screenshots) shows that :
- The option to force unicode font does not affect the behaviour issue of (n)nbsp characters.
- When used in /say and /tellraw in commands blocs, both characters act as intended.
- When used in chat messages, and in /say and /tellraw directly from the chatbox, the NBSP character does not act as intended (the line-breaking behaviour still occurs)
- In all test cases, the NNBPS act as expected.
Possible source of the issue
The issue with NBSP seems to come from the chat system, and not elsewhere, thus not affecting command blocks
Before the rendering issue was fixed, NBSP character was badly rendered in the chatbox, but rendered as a space in the message when sent (with line break behaviour). This suggests that NBSP was replaced by a regular space before rendering in chat. Even after the rendering fix (23w17a), NBSP sill acting as a regular space suggets that the NBSP->space replacement still occurs (this may be related to MC-94456).
Possible fixes
"No-break" behaviour
I would just suggest to not replace the NBSP character by a regular space (may cause an issue with flood/spam protection MC-94456).



Confirmed for 16w14a.
Looks like it is not a Minecraft bug.
The problem lies in the StringUtils (Apache) class. The Pattern WHITESPACE_PATTERN is probably incorrect.
Pattern.compile("(?: |\\u00A0|\\s|[\\s&&[^ ]])\\s*");The Apache method normalizeSpace(String) first trims the text using the method String.trim()), which does not trim the \u00A0 character, see Character.isWhiteSpace(char).
After that it replaces all parts that match with the pattern with a space. As the pattern is not working correctly it replaces every single \u00A0 However, even if the pattern would work as supposed
it would could single \u00A0 to stay whereas multiple \u00A0 become a space.
See StringUtils source code
Confirmed for 16w15b.
Please link to this comment
And can anyone confirm this? If so please close this report as invalid
Confirmed for 1.9.3-pre1.
null, can you confirm that it is not a Minecraft bug? If so there is no need to confirm it for every version
It's assigned, and it may be fixable by mojang, so we'll keep this open until ProfMobius (Thomas Guimbretiere) decides this is not a minecraft bug.
Assigned the ticket to null as the original reporter is inactive.
Marcono1234, it seems like you're right.
Decompiled via MCP 9.24 beta:
/** * Process chat messages (broadcast back to clients) and commands (executes) */ public void processChatMessage(CPacketChatMessage packetIn) { // ... else { this.playerEntity.markPlayerActive(); String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s); // <- here // ... } }net.minecraft.network.NetHandlerPlayServer.processChatMessage(CPacketChatMessage) calls org.apache.commons.lang3.StringUtils.normalizeSpace(String), which uses its WHITESPACE_PATTERN.
Mojang can fix this by not using Apache's normalizeSpace(String), and instead use their own pattern.
Edit: I think this can also be fixed by calling normalizeSpace(String) twice.
In apache/commands-lang 3.4 the method normalizeSpace(String) is different and does not include \u00A0 anymore, see LANG-1184
This means upgrading the apache library used by Minecraft would not fix this problem
I just realized, this can definitely be fixed by replacing all NBSPs with spaces first:
... String s = packetIn.getMessage(); s = StringUtils.normalizeSpace(s.replace('\u00A0', ' ')); // <- there ...Isn't this behavior the purpose of the nbsp character - that it isn't coalesced into a single space? That's how it works in HTML and in most other contexts...
@[Mod] Pokechu22, but I think the whole point of this replacement is to prevent spam messages or messages of that kind, so I assume it should apply to nbsp characters as well. Otherwise I do not understand why this normalization is done in the first place.
I just checked, and normalizeSpace explicitly checks for NBSP and replaces it with a space, but doesn't remove duplicates (note that Character.isWhitespace for NBSP is false). The analysis refers to some regex, but that regex doesn't exist anymore.
I don't think removing duplicate space to prevent spam makes too much sense; it's just as easy to spam, say, _ or █, except those symbols are even wider than a space.
The behavior with a NBSP allowing sending an empty message is different and I'd say that actually is an issue (note that it also happens for other spaces, including the ogham space ( )).
Cannot reproduce in 21w40a.
I am still unable to reproduce this issue in 1.19 Pre-release 5.