Windows 10 CLI UTF-8 encoding

為{幸葍}努か 提交于 2019-12-06 12:07:41

Use chcp 65001 then run with java -Dfile.encoding=UTF-8 Test2:

chcp 65001
javac -encoding UTF-8 Test2.java
java -Dfile.encoding=UTF-8 Test2

Remember to name your Java source file after the class name, case-sensitive.

After following @Andreas advice, i have further explored the issue and found a fix that works:

First force cmd to use chcp 65001 (UTF-8) following this link on superuser.

Secondly use the following command:

set JAVA_TOOL_OPTIONS =-Dfile.encoding=UTF-8
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!