hello i want to run java code in command prompt that read UTF-8
how can i do that
Go to the language settings, click Administrative language settings, then Change system locale… and tick the Beta: Use Unicode UTF-8 for worldwide language support option.
CMD.exe is a just one of programs which are ready to “work inside” a console (“console applications”). AFAIK, CMD has perfect support for Unicode; you can enter/output all Unicode chars when any codepage is active.
fire up your java with
java -Dfile.encoding=UTF8 <Your class Name>
There are methods in Java classes that accept a charset. See: InputStreamReader(java.io.InputStream, java.nio.charset.Charset) for instance.
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:
http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With