title: Numbered special characters not being sent correctly by jquery ajax
body: <p>I have seen several post about different way to get around special characters not transmitting correctly. But, I was wanting a better and simpler solution (may not find it). </p>
  
  <p>I have a function that I pass an object too. In the object (myObject), there can be some text with special numbered characters (Bill &amp; #8217;s, the right single quotation mark special numbered character).</p>
  
  <p>When I try to send the data, it chokes. So, then I went through my code and escaped everywhere it accepted user input and unescaped where the information was displayed.</p>
  
  <p>Problem:</p>
  
  <ul>
  <li>Possibly missing places that display or accept user input.</li>
  <li>The data is store with the escaped characters.</li>
  </ul>
  
  <p>I have seen solution where the special characters would be sanitized, but it would require a list of the special characters. Or I could try to decode the escaped characters on the back end.  </p>
  
  <ul>
  <li>Backend - MVC .net C#</li>
  <li><p>jQuery Version: 1.7.2</p>
  
  <pre><code>var json = $.toJSON(myObject);
  
  $.ajax({
      type: 'POST',
      url: RootUrl + "Viewer/Save/",
      data: { "json": json },
      async: false,
      contentType: "application/json; charset=utf-8",
      success: function (data) {
          var $("#display").(data);
      },
      error: function (xhr, status, error) {
          alert(error);
      }
  });
  </code></pre></li>
  </ul>
  
  <p>More information:</p>
  
  <p>The json string is passed to a MVC controller. The method looks like this.</p>
  
  <pre><code>public ContentResult Save(string json)
  {
      try
      {
          dynamic data = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize&lt;dynamic&gt;(json);
      }
      catch (Excepteion ex)
      {
           // More code
      }
  }
  </code></pre>
  
  <p>The error message I get when I am in the Chrome debugger is:    </p>
  
  <ul>
  <li>500 (Internal Server Error)</li>
  </ul>
  
  <p>More I think about it, I am wondering if there is a setting in the backend that needs to change to accept the special numbered character. The reason I say this is because if I set a break point a the beginning of the MVC controller method, it actually never makes it to the break point. But if escaped or the apostrophe sign is used, it is fine.</p>
  
  <p>I will continue to search and respond back with my findings.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Following the information: <a href="https://stackoverflow.com/questions/6025522/getting-a-potentially-dangerous-request-path-value-was-detected-from-the-client/6026291#6026291">Getting &quot;A potentially dangerous Request.Path value was detected from the client (&amp;)&quot;</a></p>
  
  <pre><code>    [ValidateInput(false)]
      [HttpPost]
      public ContentResult SaveTailoring(string json)
  </code></pre>
  
  <p>I added this to my code and it solved my problem of getting the data into the controller. I am goig to research so more and would appreciate any thoughts on the pros and cons of this technique.</p>