08-31-2010 02:57 AM
I am trying to connect to my server..
It gives me reply in Unicodes..how to decode that..
08-31-2010 03:17 AM
08-31-2010 03:19 AM
Is that the actual sequence of characters (that is, '\', 'u', '0', etc.)? Or is whatever is rendering the string escaping non-printable characters? In other words, is the first character '\\', or is it '\u0004'?
The question marks later in the string suggest to me that a byte sequence has already been converted to characters, but using the wrong character encoding.
08-31-2010 03:43 AM
Thanks for the reply.
08-31-2010 04:23 AM
I think Ted has already identified the problem.
Remember that the IO Stream does not send characters, it sends bytes. Something in your code converts this to characters. It appears this conversion is incorrect. Have a look at the code you use to convert from bytes to String and make sure the process you use here is the reverse of whatever your server is doing when it converts to the byte stream.
08-31-2010 05:03 AM
Peter thanx for the reply.
Yeah i m getting in bytes and converting it into string and i get the above(img) output
reply = new String(buf, 0, count);
The server is made in C#.net ..its uses BinaryReader and BinaryWriter.
And there is no API for binary read/write AFAIK.
I am stuck here and not able to proceed forward.
08-31-2010 06:19 AM
Sorry I have no idea what BinaryWriter does, though I suspect someone on this forum probably does. That said, It would surprise me if it was not well documented, and I'm sure you could reverse engineer it. So don't give up just yet. In fact Google it, someone has probably already tried to read a BinaryWriter file in java and knows what to do.
08-31-2010 06:23 AM
Thanks for all your effort.
I am googling for it. If i get something..i will let you know.
08-31-2010 04:39 PM
Well he said it is in Unicode and it looks to be in Unicode so you would use "UTF-16BE" or "UTF-16" instead of "UTF-8".