Reputation: 557
The Swing program shows wrong characters instead of German umlauts. This button should be "Schließen", for example: . This occurs for all UI elements as far as I can see.
The code to create the UI is nothing unusual, for example:
about = new JButton("");
about.setToolTipText("Über das Programm");
I already checked following things:
The project also uses gradle (6.8).
What could be a reason for this behaviour? When I talked to somebody who compiled the same program on Linux they didn't seem to have this problem.
Edit:
I also found code such as this:
JLabel test = new JLabel();
test.setFont(new Font("Arial", Font.PLAIN, 12));
test.setText("<html>Something with ß</html>");
Arial surely supports umlauts, but this code still did not display the ß correctly
Upvotes: 4
Views: 782
Reputation: 557
Thanks to the commenters I could get to the bottom of the issue: The compiler was not parsing my source code as UTF-8 character encoding.
I had to add following to my build.gradle
file:
compileJava {
options.encoding = 'UTF-8'
}
Upvotes: 6