I have a server side process.php script that echos two chars:
echo chr(127);
echo chr(128);
On the client side, I have a java script (running in an html page with UTF-8 encoding) that posts to the php script and expects a response:
const xhr = new XMLHttpRequest();
// post xhr to php, check for DONE and 200, and get the response
console.log(xhr.responseText);
For 127, I get the response as a string with one character representing 127 as expected. But for 128 and above it gives me 3 chars, -17, -65 -67. Combed and trawled the net, but nothing. Am quite surprised to not find any info online on transmitting bytes from a server to a client. Am a desktop C++ programmer, btw hence this has me stumped!