分享一个JS将PHP htmlspecialchars 编码后的字符串解码的例子:
例如:
var encodedStr = "'"alert;pg'("XSS")";
function decodeEntities(encodedString) {
var textArea = document.createElement('textarea');
textArea.innerHTML = encodedString;
return textArea.value;
}
console.log(decodeEntities(encodedStr));
http://stackoverflow.com/questions/1147359/how-to-decode-html-entities-using-jquery/1395954#1395954
原问题的链接