title: Why doesn't encodeURIComponent encode single quotes/apostrophes?
body: <p>The <strong>escape()</strong> function, was deprecated and replaced by <strong>encodeURIComponent</strong> but <strong>encodeURIComponent</strong> doesn't encode single quote/apostrophe character. Which I need to escape the apostrophes in a persons surname (E.g. 'O'Neill') in an AJAX form. Why would they remove the ability of something they were trying to improve?</p>
  
  <p>EDIT: </p>
  
  <p>So here is a code example to explain the problem more thoroughly. So as you can see the surname 'O'Neill' contains an apostrophe that needs to be escaped when passing the variable in the url. But this would also happen in other places in the form, for instance if an address entered was 'Billy's Tavern'.</p>
  
  <pre><code>&lt;input id='surname' value="O'Neill"&gt;                        
  &lt;script&gt;
  var get_url = '?surname='+encodeURIComponent($('#surname').val());
  $.ajax({
      url: get_url
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>My current solution, using a custom function. My question was just to ask why there is a need for a custom function.</p>
  
  <pre><code>&lt;script&gt;
  function customEncodeURIComponent(URI) {
      return encodeURIComponent(URI).replace(/'/g, "%27");
  }
  &lt;/script&gt;
  
  &lt;input id='surname' value="O'Neill"&gt;
  &lt;script&gt;
  var get_url = '?surname='+customEncodeURIComponent($('#surname').val());
  $.ajax({
      url: get_url
  });
  &lt;/script&gt;
  </code></pre>