Hi,
I have written an encryption function in PHP which at a certain point uses the built in chr() function to convert a byte back to a character. This works fine, however when I do the same thing in Java ( by casting the byte as a char ) I have problems.
It seems characters with ASCCI values greater than 128 are being displayed as the wrong characters and sometimes not at all ( they become ? ).
Some example output from the PHP ...
_____Byte______ASCCI_______Char
....-785314906..........166...................... �
....805139163...........219.......................�
Im assuming this is because the way PHP handles the bytes differs from java. Does anyone know how I can get my java representation of these bytes to work for conversion to characters ?
My java code goes like this ...
System.out.println((char)(byte) byteCode)
* byteCode is an integer variable containing values like those shown above.
Many thanks for any insight ...
Chris