• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Ascii character

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 76395
364
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also check out this sample program
 
Campbell Ritchie
Marshal
Posts: 76395
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
What kind of corn soldier are you? And don't say "kernel" - that's only for this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic