Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UTF-8 in command prompt

hello i want to run java code in command prompt that read UTF-8

how can i do that

like image 610
asas Avatar asked Jan 10 '11 17:01

asas


People also ask

How do I display the UTF-8 terminal?

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.

Does Command Prompt support Unicode?

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.


2 Answers

fire up your java with

 java -Dfile.encoding=UTF8 <Your class Name>
like image 108
dom farr Avatar answered Oct 06 '22 00:10

dom farr


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

like image 37
Mike Minicki Avatar answered Oct 05 '22 22:10

Mike Minicki