UTF-8 encoding in IntelliJ build log/output
posted on 2023-03-20
Hard to say if it is a system configuration issue or not, but at least on my Microsoft Windows the JVM running IntelliJ Idea Java IDE defaults to a non-unicode file encoding. This causes build log/console in the IDE to not be unicode capable and any unicode character is not show correctly.
The fix or a workaround for the issue was to add:
-Dfile.encoding=UTF-8
line to the end of idea64.exe.vmoptions
file IntelliJ Idea installation directory.
Now after starting the IDE the underlying JVM will default to UTF-8
, and you can marvel at the unicode emojis in your build logs - joking ;-)
Nevertheless, a shameless plug – below you can see an example of unicode box drawing characters used to group multiline logs from RevDeBug’s instrumentation process:
The only downside is that IntelliJ will ask what to do with this modified file during updates. You’ll be presented with option to REPLACE
the file with vanilla version or you will be able to change the default operation to IGNORE
to preserve the change. This is mundane but the updates are not something that happen daily.
Happy hacking!