java 命令提示符中的 UTF-8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4649765/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UTF-8 in command prompt
提问by asas
hello i want to run java code in command prompt that read UTF-8
你好,我想在读取 UTF-8 的命令提示符下运行 java 代码
how can i do that
我怎样才能做到这一点
回答by dom farr
fire up your java with
启动你的java
java -Dfile.encoding=UTF8 <Your class Name>
回答by Mike Minicki
There are methods in Java classes that accept a charset. See: InputStreamReader(java.io.InputStream, java.nio.charset.Charset) for instance.
Java 类中有一些方法可以接受字符集。参见: InputStreamReader(java.io.InputStream, java.nio.charset.Charset) 例如。
http://download.oracle.com/javase/6/docs/api/java/io/InputStreamReader.html
http://download.oracle.com/javase/6/docs/api/java/io/InputStreamReader.html
But make sure you read Java Internationalization FAQ first, so you will understand how Java handles Unicode:
但请务必先阅读 Java 国际化常见问题解答,以便了解 Java 如何处理 Unicode:
http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp
http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp