title: How to write a tab-delimited file when the tab-delimiter comes from a database?
body: <p>I have a problem really phrasing this question so i try to give an example:</p>
  
  <p>The following code works and creates the expected output: a delimited file where each column is separated by a "real" tab.</p>
  
  <pre><code>CSV.open(@targetfile, "wb", "\t") { |csv| 
  csv &lt;&lt; ["row", "of", "CSV", " }
  </code></pre>
  
  <p>The following code does not produce the expected out. </p>
  
  <pre><code>CSV.open(@targetfile, "wb", @targetdelimiter) { |csv| 
  csv &lt;&lt; ["row", "of", "CSV", "data"] }
  </code></pre>
  
  <p><code>@targetdelimiter</code> in this case comes from the database and is actually the string <code>'\t'</code> (without the quotes) which can be configured by the user. </p>
  
  <p>This code produces also a delimited output, but i can see the <code>'\t'</code> instead of a "real" tab character. </p>
  
  <p>What can I do with the second code block to get the same result as the first codeblock given that the <code>@targetdelimiter='\t'</code> from the db?</p>