• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing unicode character

 
Ranch Hand
Posts: 198
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Manoj Kumar Jain
Ranch Hand
Posts: 198
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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..
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic