Take the 2-minute tour ×

I am writing very simple console application in Java.

The problem is that I need to ouput cyrillic and estonian non-utf8 symbols to console, but in Windows I get bunch of strange symbols and in MacOsX I get only ???? instead of something more readable.

How Can I achieve my aim?

--UPDATE 1--

locale gave me:


Seems I am stuck with that UTF-8 thing %)

Strange idea:

Is there any way to get a console from eclipse and use it outside of eclipse?

share|improve this question
First thought: use a font that supports those particular unicode values –  cyclops Mar 22 '12 at 12:15
Is it possible to set a font for System.out.println()? –  Jevgeni Smirnov Mar 22 '12 at 12:21
Windows DOS command prompt is a non-Unicode program: it only supports certain fonts (right-click on top-left icon to access its properties) and it depends on your current language setting. You don't have much choice under Windows other than to modify the current Language for non-Unicode programs to the language you want but this is a global setting which you need to restart technet.microsoft.com/en-us/library/cc721887(WS.10).aspx –  eee Mar 22 '12 at 14:03
For MacOSX i8n support: rift.dk/news.php?item.7.6 (retrieved 2006) and stackoverflow.com/questions/4606570/os-x-terminal-utf-8-issues –  eee Mar 22 '12 at 15:43
Do you use precompiled classes on Mac or do you compile from source? If you compile from source, what is the character encoding of the source files? javac will assume it's the system default encoding, utf-8. If it's something different you have to use the -encoding parameter. Otherwise the compiler can't know what characters your source files have. –  Joni Mar 23 '12 at 7:29
add comment

1 Answer

up vote 1 down vote accepted

Windows Terminal: The terminal program, cmd.exe, doesn't use the same encoding as the rest of the OS, and from Java you have no way of knowing if you are being run from a terminal or not. You have to set the font used by cmd.exe to Lucida Console and switch the "code page" with chcp before running the program:

OS X Terminal: as far as I know the terminal is configured for UTF-8, so you can just use UTF-8. Use the locale command to check your encoding.

share|improve this answer
Ok Thanks. At least I know what's going on. Also check the update please. –  Jevgeni Smirnov Mar 22 '12 at 14:17
chcp works fine for code pages with single-byte character sets like Windows-1251 and Windows-1257. But, for double-byte character sets like CJK Unified Ideographs, you still need to install its multilingual language pack to set the system code page for the particular language. Otherwise, it will return Invalid code page error. –  eee Mar 22 '12 at 14:47
add comment

Your Answer


