Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
975 views
in Technique[技术] by (71.8m points)

java - IntelliJ IDEA incorrect encoding in console output

It seems to be really crazy, but I can't do anything with broken encoding in the console of my IntelliJ IDEA.

Things I made to overcome this:

  1. Set -Dfile.encoding=UTF-8 and -Dfile.encoding=UTF-8 in both idea.exe.vmoptions and idea64.exe.vmoptions (I use 64 bit version though).
  2. Added -Dfile.encoding=UTF-8 and -Dfile.encoding=UTF-8 to run/debug configuration of my application.
  3. Changed Settings > Editor > File encodings IDE Encoding/Project Encoding/Default encoding for property files to UTF-8.

Having all these done, there is still no luck and symbols are not shown correctly in the console. I tried to debug the java.io.PrintStream#println(java.lang.String) method and found out that System.out.textOut.out.se.cs equals to windows-1251. No idea where this value is coming from.

This issue has been bothering me for a long time and I was unable to find anything in the web that could help me.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This works for me.

  1. Close your intellij idea
  2. Search and open file idea.exe.vmoptions inside idea installed, for example: "C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2in". After add next line: -Dfile.encoding=UTF-8
  3. (Optional) if you have file idea64.exe.vmoptions, add the same line too.
  4. Start your intellij idea.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...