IntelliJ Java IDE
The moose likes Beginning Java and the fly likes Printing unicode character Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Printing unicode character" Watch "Printing unicode character" New topic
Author

Printing unicode character

Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 153

Hi all,

Just to see some Unicode character I wrote a small code to print the Unicode character from 128 to 255.



when I run the code the output was as below


it prints "?" up to 159, prints space for 160 and after that it prints some symbol.
So I am wondering why its printing "?" for many of the values. do we need to install fonts in my system to get these symbols printed ?


Do not wait to strike till the iron is hot; but make it hot by striking....
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 1610

Manoj Kumar Jain wrote:it prints "?" up to 159, prints space for 160 and after that it prints some symbol.
So I am wondering why its printing "?" for many of the values. do we need to install fonts in my system to get these symbols printed ?

Not sure, but it's unlikely that you'll get the output on a standard console or command line program (although it may be possible in some Unix terminal emulators).

Have you tried displaying via a Java Swing Component, such as a JTextField? I'm no GUI expert, but I suspect it'd be much more likely to handle "abnormal" characters than a standard 'term'-type display.

Winston


More computing sins are committed in the name of efficiency (without necessarily achieving it)
than for any other single reason...including blind stupidity. — W.A. Wulf
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 153

No Winston, There is no GUI component. I am running this piece of code in eclipse with windows environment, I can see this output on the eclipse console.
however now I tried to run it one the command prompt, and output was the same.

[edit]
However when I look for the values of these Unicode 128-159 it says that it's a <control> kind of but have some symbol to represent.
below is the link:

http://www.ssec.wisc.edu/~tomw/java/unicode.html#x0000

So is that the reason that these are not being printed ? not sure..
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 11642

Are you sure that the console output in Eclipse or on the command prompt is using a font that contains the Unicode characters that you want to display? Not all fonts (especially the default font used for the command prompt window) contain all Unicode characters, and you'll see question marks for missing characters.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: Printing unicode character
 
Threads others viewed
casting problem
String reversing without using String functions...
Quick String to <char> Array Conversion
String reversing without using String functions...
ASCII - UNICODE
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture