Broken text formatter

I’ve been learning how to make my first plugin, and after many attempts I got it to work. Except I couldn’t get the text to work right. The formatting just breaks the text, doesn’t support accents and shows some weird letters. I’ve tried to follow examples from other codes, but it doesn’t look like my code is in fault. Does anyone know how to fix this? I’ve tried using “§5§l” and “TextColors.RED, TextStyles;BOLD” but both gave the same result.

I’m using IntelliJ IDEA Community 2019.1

Hey,

so i am pretty sure the line breaks are a normal behavior of the Minecraft-Client: if the text is too long to display it in one line, the client is adding a line break. Nothing you can do there. In fact i even think the number of chars until a line break is added can vary from client to client, depending on their settings and window-size. And there is no way for the server to know how much that is. (i might be wrong tho)

The “weird letters” are probably caused by a difference in the file/text-encoding between you and your minecraft-client. I believe the correct encoding is UTF-8. So make sure the file encoding in IntelliJ is set to this (bottom right):
image

Also don’t use formatting codes (§5§l), use TextColors.RED, TextStyles.BOLD :slight_smile:

Thank you so much for your response! I had hope this would work, but I just checked and found out it is already UTF-8 =. I also tried using newer versions of Intellij, but same result…

When you said your using TextColor. How are you using text colour?

Text.of(TextColor.RED + "message");

Or

Text.builder("message").color(TextColor.RED);

I actually found the solution, thanks for your hint.
By adding

compileJava.options.encoding = ‘UTF-8’

to build.gradle, I got it to work.
Thanks for the replies.