title: Escaping for CSV
body: <p>I need to store a string in a MySQL database. The values will later be used in a CSV. How do I escape the string so that it is CSV-safe? I assume I need to escape the following: comma, single quote, double quote.</p>
  
  <p>PHP's <code>addslashes</code> function does:</p>
  
  <blockquote>
    <p>single quote ('), double quote ("), backslash () and NUL (the NULL byte).</p>
  </blockquote>
  
  <p>So that won't work. Suggestions? I'd rather not try to create some sort of regex solution.</p>
  
  <p>Also, I need to be able to unescape.</p>