1.點開help,點擊如圖
2. 點進去之后,加入代碼
-Dfile.encoding=UTF-8
重啟idea
(1) JDK17及以前:在Custom VM Options中增加 -Dfile.encoding=UTF-8
(2) JDK18:在Run->Edit Configurations中增加VM Options: -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8
(3) JDK19到JDK21:在Run->Edit Configurations中增加VM Options: -Dstdout.encoding=UTF-8 -Dstderr.encoding=UTF-8