• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to define unicode character?

 
lauren bai
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write a class and want to print character "PI".

class test {
public static main(String args[]) {
char c = '\u03c0';
System.out.print(c);
}
}

Output: ?

I don't know why I get "?" instead of the character "PI".

Thank you in advance.
 
Peter Gravestock
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a problem with the device you are outputing the data to? Perhaps it can not handle UNICODE characters, only ASCII. Maybe if you create a small Swing program and output the test there, I am sure it will display better.
 
Saurabh Khanna
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the same problem. Chaning the DOS console font to Lucid Console still does'nt fix the problem even though Lucid Console is supposed to display these chars properly as per spec?
 
Raghu Shree
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Its work fine in Eclipse like editor and all other font which is support unicode chars. Change the screen font which is support unicode and run again this code.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic