XMLHttpRequest responseText for arrayBuffer, unicode U + FFFD
In the response text of the request for full-replaceable Unicode characters (U + FFFD). I am unable to set the responseType for arraybuffer. Answer where responseType can be set to "arraybuffer"
Is there a way to recover the original binaries (raw data) that were appended to the string?
console.log(xhr.responseText); // 'at '
console.log(xhr.responseText.codePointAt(0)); // '97'
console.log(xhr.responseText.codePointAt(1)); // '116'
console.log(xhr.responseText.codePointAt(2)); // '65533'
1) Is data lost when passed to String by Javascript?
OR
2) Is the data safe as String, but I just haven't found the right way to decode it to binary / hex / decimal? (In this case, the data is accurate, but when printed, it just displays the replacement character.)
source to share
I find it very difficult to deal with the same problem. I don't know the correct solution, but one thing I know for sure is that when you have this \ ufffd character your data is gone, you cannot figure out what it was and you should definitely solve the problem before .... also I am using wireshark to check what kind of data I am actually getting and the data I received was correct, so the problem is probably happening somewhere around the XMLHttpRequest object !!
source to share