Hello everybody,
I'm working with Eclipse 3.1, JDK 1.4.2
I have the following problem.
I have a string containig generated unicode signs for a display connected via a serial com port.
The sring looks like:
\u0096\u00AD\u00A2\u008D\u008E
These signs don't make sense, they are converted arabic unicode signs. They needed to be converted to get the driver for the display running.
For I'm connected serial I need bytes rather than chars.
But when I go String.getBytes() the decimal representations of the signs are:
63, -83, -94, 63, 63
which doesnt make much sense, why so many 63 for example, why is not every byte negative?
I made another check going
byte textcmd[] = {(byte) 0x96,(byte) 0xAD,(byte) 0xA2,(byte) 0x8D,(byte) 0x8E};
Which is essentially just the least sugnificant byte of every char in the string.
Well the decimal represantations in this case are:
-106, -83, -94, -115, -114
which does make far more sense to me.
How can I convert my String into a byte array that looks like i wnat it (second case). Is there any java method to do so? Why does the getBytes() method fail?
Did you understand what I tried to tell you?
Can you help me?
Thank you all very much.
Greetings,
Stefan