Two Laptop Bag*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to define unicode character? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How to define unicode character?" Watch "How to define unicode character?" New topic
Author

How to define unicode character?

lauren bai
Greenhorn

Joined: Apr 08, 2005
Posts: 18
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.


SCJP (In Progress)
Peter Gravestock
Greenhorn

Joined: Apr 17, 2005
Posts: 2
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

Joined: Apr 03, 2005
Posts: 30
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

Joined: Mar 18, 2005
Posts: 143
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.


Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to define unicode character?
 
Similar Threads
Dereferenced Error Code
How many hours do you sleep every day?
Can you tell what is wrong with this loop?
[OT] How to plot a Math.sin() equation
Need help with doing a calculation in Java