| Author |
Ascii character
|
Dillibabu Balakrishnan
Greenhorn
Joined: Sep 11, 2012
Posts: 8
|
|
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
Joined: Oct 13, 2005
Posts: 32833
|
|
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
Joined: Sep 11, 2012
Posts: 8
|
|
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
Joined: Aug 09, 2012
Posts: 179
|
|
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.
|
Programming is about thinking, NOT coding
|
 |
Vishal Shaw
Ranch Hand
Joined: Aug 09, 2012
Posts: 179
|
|
You can also check out this sample program
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32833
|
|
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
Joined: Aug 23, 2009
Posts: 58
|
|
try this
|
 |
Winston Gutkowski
Bartender
Joined: Mar 17, 2011
Posts: 4905
|
|
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
|
Isn't it funny how there's always time and money enough to do it WRONG?
|
 |
 |
|
|
subject: Ascii character
|
|
|