Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ASCII to Unicode conversion

807569Jun 20 2006 — edited Jun 21 2006
Hi,

I'm reading data from a socket and I need to correctly read and store any ASCII value > 128 and < 255

e.g. � (e circumflex) has a ascii value of 136 (as shown in www.lookuptables.com)

If I hard code a char e.g. char ch = '�' then it has a value of (unicode value) of 234 and displays correctly on the java console when printed.

Can anyone please share a code example that shows how I can read e.g.� from a datastream and correctly store into a char (unicoded) variable?

I have tried the following with no luck ...

InputStreamReader isr = new InputStreamReader( m_inputStream, "ISO-8859-1" );

BufferedReader br = new BufferedReader( isr );

char ch = br.readChar()

but the char value is still incorrect.

Thanks in advance
-Joe
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2006
Added on Jun 20 2006
18 comments
282 views