On the one hand if I have
\'; console.log(s);
the browser will terminate the
Here's how I do it:
function encode(r){ return r.replace(/[\x26\x0A\<>'"]/g,function(r){return""+r.charCodeAt(0)+";"}) } var myString='Encode HTML entities!\n"Safe" escape