I'm using JDK 21, that has the file.encoding
automatically to UTF-8 but, even adding it explicitly as a command argument, nothing changes. I checked the property in the code and it is indeed UTF-8.
I've set sun.stdout.encoding
to UTF-8 manually too. It changes the output, but still unreadable.
Printing the emoji 🤣 on System.out with the sun.stdout
the result is -fñú and without it, it just shows a ?
On another post I saw people suggesting to change the terminal code page or use the System.console().writer
instead of System.out
, but neither worked for me
The source is being encoded with UTF-8 properly too
- JDK 21
- Windows 11
- Windows Terminal - Powershell