File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes System.out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "System.out" Watch "System.out" New topic


Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 389
Does anyone have any idea why does the following prints ???

package pre_emptive.augment.test;
public class TestOne {
public static void main(String[] args) {
String str= new String("ЁЁЁЁЁЁЁЁ");

I guess System.out.println only prints english characters. Is this something to do with ResourceBundling or Locale settings....

please help ...

SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Are you sure you apparent problem is not related to the console where you are printing the results of System.out.

For instance, Windows console does not support unicode, therefore nothing that you prints with System.out that is outside the ASCII domain will be correctly printed in the Windows console.
Vlado Zajac
Ranch Hand

Joined: Aug 03, 2004
Posts: 245
System.out is PrintStream an it uses system default character encoding, characters which cannot be represented in the encoding are changed to ?.
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
For printing you need the encoding of the JVM.By default JVM uses the encoding of the OS.From System.getProperty("file.encoding") you can get the encoding settings of your JVM.

Rahul Bhattacharjee
LinkedIn - Blog
I agree. Here's the link:
subject: System.out
It's not a secret anymore!