Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ascii character

 
Dillibabu Balakrishnan
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
How do i display ascii character from 0 to 255 in java
(from 0 to 127 no problem,from 128 to 255 it is displaying ? mark)

Thanks and Regards
Dillibabu.B
 
Campbell Ritchie
Sheriff
Pie
Posts: 47261
52
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
128…255 are not ASCII characters. I suggest you read about the history of character encoding here.
Java can display any Unicode character, but not every platform can. The Windows® command line is notorious for its inability to display characters. Rather than using System.out.println, try a Java applicatoin, eg JOptionPane.showMessageDialog(null, "™ˆª");
 
Dillibabu Balakrishnan
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell Ritchie,
Thanks for reply my post
i agreed that from 128 to 255 is not ascii character but it is extended ascii character know then how do i display that character in java

Regards
Dillibabu.B
 
Vishal Shaw
Ranch Hand
Posts: 179
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Basically, The characters (with ASCII>=128)that you want to display, will display to an outputstream that has been encoded properly.

Unfortunately in this case the PrintStream is not encoded with the necessary encoding.
You can try encoding your PrintStream.
Or,you can try outputing the characters to a File (FileStream) and encode it with UTF-8.
 
Vishal Shaw
Ranch Hand
Posts: 179
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also check out this sample program
 
Campbell Ritchie
Sheriff
Pie
Posts: 47261
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dillibabu Balakrishnan wrote: . . . then how do i display that character in java

Regards
Dillibabu.B
I have already given you one way to do it.
 
Gihan Pandigamage
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this

 
Winston Gutkowski
Bartender
Pie
Posts: 9477
50
Eclipse IDE Hibernate Ubuntu
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dillibabu Balakrishnan wrote:i agreed that from 128 to 255 is not ascii character but it is extended ascii character...

No it ISN'T. I suggest you read Campbell's link before making statements like that.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic