Console output has wrong encoding in log file

Answered

Hello!

I am saving my console output to a file via the "Logs" tab in the run configuration of my program. However, no matter what I do, the log file becomes ANSI-encoded and all non-ANSI characters are displayed as question marks. The console output looks perfectly fine in IntelliJ itself. I've tried out every solution that I could find via Google:

  • Checked if UTF-8 is set at the bottom right of the editor window (it is)
  • Set everything (global, project and default encoding) in Settings > Editor > File encodings to UTF-8
  • Added the "-Dconsole.encoding=UTF-8 -Dfile.encoding=UTF-8" options to the configuration's VM options
  • Inserted the "-Dconsole.encoding=UTF-8 -Dfile.encoding=UTF-8" options into both "idea.exe.vmoptions" and "idea64.exe.vmoptions"
  • Changed the encoding of the file to UTF-8 within Notepad++ (it's not a display problem, the file is actually not encoded in UTF-8)
  • Restarted both IntelliJ and my machine several times since applying all these changes

I am using IntelliJ IDEA 2019.1 Ultimate and Windows 8.1 (which is probably the root of the problem, I know - but IntelliJ should be able to decide the encoding of the file it creates). Since my console output is too long to be fully displayed within IntelliJ and I am interested in single characters of the output, I need the log file and I need it to be in UTF-8.

Any ideas what else I could try to solve this? Thank you!

0
2 comments
Avatar
Permanently deleted user

Ugh, thank you. I upvoted it, but seeing as the issue was created 4 years ago, it probably won't be resolved before I finish my project. Guess I'll have to redirect System.out and System.err programmatically for now.

0

Please sign in to leave a comment.