Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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("ЁЁЁЁЁЁЁЁ");
System.out.println(str);
}

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

please help ...
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic