Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode output on Windows command line?

Tags:

unicode

cmd

I wrote a small Java application which output includes Unicode characters. When I use Eclipse to run it—I see all the output as expected.

The people who are supposed to use the application will run it as a jar file. I thought they could use standard cmd window, but in this window the Unicode appear as Gibberish.

Is there a way to make "cmd window" recognize the Unicode chars and display them properly? Or, is there any tool to easily run the jar file and get the correct output?

BTW - redirecting the output to a file works okay, but the program is interactive, so this will not be a good solution.

Edit: Thanks everybody for the suggestions. It seems that the cmd fonts don't have the specific characters I need, and this is why changing the code page did not solve my problem.

I found a way to add more monospaced fonts to the console, but after I add them any change that I want to do regarding the fonts (even choosing one of the original fonts in a different size) - is ignored.

I think that I will simply try with another tool, which supports chhosing a differnt font more easily.

like image 948
Dikla Avatar asked Jun 23 '09 21:06

Dikla


People also ask

Does Windows command prompt support Unicode?

AFAIK, CMD has perfect support for Unicode; you can enter/output all Unicode chars when any codepage is active.

Does CMD support ASCII?

The encoding of cmd does not support non-ASCII character. (Or the deeper layer does not support non-ASCII).


2 Answers

Reference: Java Unicode on Windows Command Line

Try chcp 1252 or chcp 65001 from the command line. With Lucida Console or other font support.

like image 136
maxwellb Avatar answered Sep 28 '22 05:09

maxwellb


try CMD /c /U java your.jar

like image 42
Shay Erlichmen Avatar answered Sep 28 '22 05:09

Shay Erlichmen