title: Inserting Escape Characters
body: <p>I want to replace and insert escape character sequences with their escape character values, also taking into account that '\' nullifies the escape character.</p>
  
  <p>For example</p>
  
  <pre><code>"This is a \n test. Here is a \\n which represents a newline"
  </code></pre>
  
  <p>What is the easiest way to achieve this in Ruby?</p>