Hmm. I'm a bit out of my depth in this arena. Sorry for the typos in the ascii codes. I had a lot going on here at that moment.
You may or may not want to take a peek at this thread where I went over a lot of questions about sockets in PHP and utf8. Weedpacket was kind enough to spend some time teaching me about strings in php.
[man]stream_socket_recvfrom[/man] is a php function that returns a string. It's important to understand that PHP strings are just raw bytes really and it's up to YOU to know what kind of string is in there because various string functions interpret them as character strings in different ways. It's up to you as a programmer to know if a given string value is really just ASCII text or whether it's utf8 or some other multibyte char string or something else entirely. I use socket functions in some PHP applications to transmit bitmapped images, for instance. socket_read might hand me a PHP string but I know it's a string of bytes that represent a bitmap image.
Even if you are sure your string value is supposed to be text, it could have some kind of multibyte encoding. You'd need to know what it is so you know what functions to use or whether to utf8_decode it. There are various different string functions you might use. For example, [man]strlen[/man] assumes it's either extended ascii or iso8859 or something and determines the string's length assuming that each byte is exactly one char. [man]mb_strlen[/man], one the other hand, lets you specify an encoding. The two functions may return different values on the exact same string variable. If the data coming off your socket represents a JPEG then you might want to write it directly to a file with a .jpg extension.
If the highest byte sent by your remotes is 0111 1111, then utf8 encoding them wouldn't change a thing. As far as I know, any char with a zero in the large bit is the same utf8 encoded as it is in plain ascii. In fact, UTF8 encoding may have nothing to do with your problem. I just don't understand how you'd ever get a 1 in your high bit if you're only using ascii chars from 0000 0000 to 0111 1111. Are you transmitting raw data or something? If not, it seems to me that the data you are reading from your socket is not sub-127 ascii but either something that is still encrypted or something that has been encoded somehow.
I apologize if I'm just confusing things. Perhaps we can simplify. Let's say your "remote" is something hooked up via socket to your socket listener. Let's say your remote takes the word "Yes" and just sends it over the socket. To me, I would expect:
0101 1001 - Y
0110 0101 - e
0111 0011 - s
Byte order would be irrelevant because we're talking single bytes regardless of whether it's utf8 or ASCII.
Now if your remote encrypted the message and then sent it across the socket, I'd have no idea what to expect on the other side. This is what I was thinking in my first post. If you could spell out a bit more about the encryption stack you have, that would be helpful.