![]() |
representing the extended ASCII set in Strings
hi everyone,
im working on a chat application project where the user can enter some text, this text goes into my compression algorithm which outputs a set of 8 bits with values from 0-255. I need to be able to take a value like 150 and change that into a string send it via TCP, recieve it on the other end and convert it back to 150. so this is some code i have wrote to investigate: :
int value = 150;the second statement "int rep = ..." will retrieve the original number..so if i say store value 128 in a byte..it will be stored as -128 but when i retrieve it with : :
int rep = (int) sendBytes[0] & 0xFF;now i need to be able to send the number -128 or the complement of 150 which is stored in the byte via TCP through a string. how can i do tht? |
Re: representing the extended ASCII set in Strings
okay here is the result of a little experiment.. very wierd results!
:
byte[] sendBytes = new byte[1];OUTPUT: :
0,0 |
Re: representing the extended ASCII set in Strings
the above experiment was in windows xp. i tried it in linux fedora core 8, the result was all the number from 128 to 255 mapped to 238!
|
| All times are GMT -5. The time now is 3:46 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC