I'm having issues with formulating the right combination for an identical match of input and output from Javascript to PHP and then back to Javascript
Javascript Encode: (textarea=input1) => outputs to (textarea=input2)
btoa(unescape(encodeURIComponent(document.querySelector('.input1').value)));
PHP Decode: (textarea=input2) => outputs to (textarea=input3)
htmlspecialchars(SQLite3::escapeString(base64_decode($_POST['input2'])));
PHP Encode: (textarea=input3) => outputs to (textarea=input4)
base64_encode(htmlspecialchars(urldecode(($d['data']))));
Javascript Decode: (textarea=input4) => outputs to (textarea=input5)
decodeURIComponent(escape(atob(document.querySelector('.input4').value)));
But they do not match, I use https://text-compare.com/ to compare, it outputs in input and shows " and it also Deletes all + signs
How do I get a both input and output to match identically?
json_encodeandjson_decodein PHP, andJSON.stringifyandJSON.parsein Javascript. Optionally you can still base64 that if your goal is to hide it. But this will be more reliable than all the escaping you're currently doing. Sidenote, maybe it's theENT_QUOTESparameter you were missing on the PHP side.mb_convert_encodingin PHP.