title: Preserving Tabs in POST Data
body: <p>I need to preserve tab characters from a textarea through POST Data. It seems that there's no way to differentiate tabs from spaces in the $_POST array, and this is really frustrating me.</p>
  
  <p>I'm using a jQuery plugin from here to allow for tab and shift+tab usage within a textarea.
  <a href="http://teddevito.com/demos/textarea.html" rel="nofollow noreferrer">http://teddevito.com/demos/textarea.html</a></p>
  
  <p>The jQuery plugin is using this as its Tab character:</p>
  
  <pre><code>$.fn.tabby.defaults = {tabString : String.fromCharCode(9)};
  </code></pre>
  
  <p>For some reason, it shows an individual space instead of each tab character, so all my code formatting is lost:</p>
  
  <pre><code>&lt;textarea name="field0" rows="26" cols="123"&gt;&lt;?php
      echo $_POST['field0'];
  ?&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>This also doesn't work. Apparently the tabs disappear before the data even reaches the str_replace function (the first double quotes is the result from when I press TAB in my text editor):</p>
  
  <pre><code>&lt;textarea name="field0" rows="26" cols="123"&gt;&lt;?php
      echo str_replace("    ", "\t", $_POST['field0']);
  ?&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>The reason I need tabs and not multiple spaces is because my application includes on-line code editor.</p>
  
  <p>Anyone have any ideas? I'm guessing the solution would involve modifying the data with javascript before it's sent through POST, but I haven't the slightest idea how to start.</p>