I ran in to some Problems when I try to do this:
public byte[] Login()
{
return Encoding.ASCII.GetBytes("WA\x01\x00\x00\x19\xf8\x05\x01\xa0\x8a\x84\xfc\x11iPhone-2.6.7-5222\x00\x08\xf8\x02\x96\xf8\x01\xf8\x01\x7e\x00\x07\xf8\x05\x0f\x5a\x2a\xbd\xa7");
}
these bytes \x8a\x84 get both encoded to \xbf\xbf what I do not want. I already tried with Default Encoding, UTF and Unicode, but they all do not provide what I need.
This is a socket client.
Well we’ve no idea what you actually do need.
If you’re trying to get the byte values
0x8aand0x84then I suggest you avoid using text to start with – it doesn’t look like this is really all text data in the first place. It looks like there are probably bits of text within it, and you could use an encoding for those aspects, but otherwise when you want fixed binary data, you should specify that as bytes, rather than decoding “text” which isn’t really text.It’s possible that using
Encoding.GetEncoding(28591)(ISO-8859-1) you’ll get what you were expecting, but it’s still not what you should be doing.