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