title: How to fix CWE 117 (Improper Output Neutralization for Logs) by JQuery
body: <p>The scan throw this error about this line:</p>
  
  <pre><code>console.log(msg);
  </code></pre>
  
  <p>I need this line on my code, but I want to change to more secure. I added this to my code:</p>
  
  <pre><code>var newMsg = msg.replace('\n', '_').replace('\r', '_');
  </code></pre>
  
  <p>Then I sent the <code>newMsg</code> to the log. I saw it isn't enough, I read that sometimes should to encoded the message. When should I encode it, and how can I do it in javascript/jQuery?</p>
  
  <p>Thanks</p>