title: Rails params parsing, escaping needed?
body: <p>I'm currently using Jquery to serialize() a form, which contains a textarea, and POST it to Rails. </p>
  
  <p>This works successfully in most cases, unless the textarea contains a line in quotes, on its own. If such a line exists Rails parses the contents between the quotes of that line as the params variable rather than the entire contents of the field.</p>
  
  <p><em>For Example: take the task[description] of the following POST Request, sent to rails 2.3.8 via Jquery Post</em></p>
  
  <p><strong>FireBug: POST Parameters</strong></p>
  
  <pre><code>authenticity_token  r0uu4QQ9e73aEsSKl2LJRIWap1BSQWMKRaieCOwHEpg=
  task[description]   line1 
                      "line2" 
                      "line3"
                      line4
  task[due_date]  
  task[project_id]    1
  task[responsible_user_id]   nobody
  task[title] Parse Bug
  </code></pre>
  
  <p><strong>Firebug: POST Source</strong></p>
  
  <pre><code>       authenticity_token=r0uu4QQ9e73aEsSKl2LJRIWap1BSQWMKRaieCOwHEpg%3D&amp;
         task%5Bproject_id%5D=1&amp;task%5Bresponsible_user_id%5D=nobody&amp;
         task%5Bdue_date%5D=&amp;task%5Btitle%5D=Parse+Bug&amp;
         task%5Bdescription%5D=line1%0A%22line2%22%0A%22line3%22%0Aline4
  </code></pre>
  
  <p>After rails parses the request params[:task][:description] gets the value of "line2" rather than the entire text block. (line1 "line2" "line3" line4)... see below</p>
  
  <p><strong>Rails development log</strong></p>
  
  <pre><code>     Processing TasksController#create (for 127.0.0.1 at 2010-07-26 17:05:06) [POST]
       Parameters: {"action"=&gt;"create", "authenticity_token"=&gt;"r0uu4QQ9e73aEsSKl2LJRIWap1BSQWMKRaieCOwHEpg=", 
       "task"=&gt;{"title"=&gt;"Parse Bug", "project_id"=&gt;"1", "due_date"=&gt;"", 
                "description"=&gt;"line2", "responsible_user_id"=&gt;"nobody"}, "controller"=&gt;"tasks"}
  </code></pre>
  
  <p>It seems that Rails parses from the <strong>POST source</strong> anything between two <strong>%0A%22</strong> as the content of the variable rather than everything after the <strong>=</strong></p>
  
  <p>The quotes are escaped as %22 but should I be escaping them differently?</p>
  
  <p>Much Thanks! <em>If my description is confusing please ask me to clarify any part of it.</em></p>
  
  <p><strong>Updated</strong></p>
  
  <p>Here's the relative Jquery used:</p>
  
  <pre><code>$('#new-item').find('.submit').live('click', function(){
      var form = $(this).closest('form');
      $.post(form.attr("action"), form.serialize(), null, "script");
      return false;
  });
  
  $.ajaxSetup({
     'beforeSend':function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
  })
  </code></pre>