-
Bug
-
Resolution: Fixed
-
Minecraft 1.11
-
None
-
Confirmed
The Turkish I thingy can strip color. In the commands below "Test" is white, not blue:
/tellraw @p {"extra":[{"color":"red","text":"Testİng"},{"color":"blue","text":" Test"}],"text":""} /tellraw @p {"color":"red","text":"Testİng","extra":[{"color":"blue","text":" Test"}]}
Code analysis
This happens because the font renderer (net.minecraft.client.gui.FontRenderer.renderStringAtPos(String, boolean)) does the following if it finds a formatting character (§):
- Convert the string to lower case
- Get the character at index + 1 to determine which formatting should be applied
The problem here is that the to lower case conversion does not always convert 1:1 but may also convert 1:2 or 1:3 (see also http://www.unicode.org/Public/UNIDATA/SpecialCasing.txt). One example for this is as described in this report the character İ which is converted to i̇ (2 characters). When the font renderer then tries to get the character determining the formatting it actually gets the formatting character itself because the string length increased.
Luckily the case in which the string gets shortened, which could crash Minecraft, is only the case for certain locales and English (which the font renderer currently uses) is not one of them.
This could probably be fixed by first getting the character at the index + 1 and then calling Character.toLowerCase(char). This way it would only "convert" invalid formatted texts to valid formatted texts, for example §İTest to §iTest (italic), which is probably not such a big problem.