As you will see on the code below, the unicode decoder works on alert but when it comes to textarea listener, it doesn't work as expected, could you catch the problem?
<textarea name="" id="first" cols="75" rows="15"></textarea>
<textarea name="" id="result" cols="75" rows="15"></textarea>
const jsEscape = (str) => {
return str.replace(new RegExp("'", 'g'),"\\'");
}
const decodeUnicodeEntities = (data) => {
return unescape(jsEscape(data));
}
alert(decodeUnicodeEntities('http://x.com\u0026shop_id=123'), 'check')
$('#first').on('change keyup paste', function() {
$('#result').val(decodeUnicodeEntities($(this).val()));
});
Also live pen, https://codepen.io/RainThemes/pen/yLqgdXK
Solved with this, https://stackoverflow.com/a/23937764/10413531