Click here to Skip to main content
15,896,544 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
    while(is.available()==0)// is - InputStream
    {}//wait for data
    StringBuffer sb = new StringBuffer();
int z = is.available();
for(; z > 0; z--)
{
sb.append((char)is.read());
}
byte [] b = sb.toString().getBytes();

-if server sends string contains Russian letters then byte-array contains negative bytes.
Please, help.
Posted

I'm guessing that's a signed byte, which would be capable of storing about the range of -128 to 127. If you attempt to store a value greater than 127, it may overflow and become a negative number. Just a guess though.
 
Share this answer
 
Cyrillic characters do not exist in the ANSI character set (range x00 - x 7F) so all will be in the range x80 - xFD.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900