title: How can I replace %2C with a <comma> in javascript?
body: <pre><code> #&amp;q=car&amp;category=Car%20Audio%2CAccessories&amp;brand=
  </code></pre>
  
  <p>I borrowed a this function from a previous question asked on SO:</p>
  
  <pre><code>function insertParam(key, value)
  {
  key = escape(key); value = escape(value);
  
  var kvp = document.location.hash.substr(1).split('&amp;');
  
  var i=kvp.length; var x; while(i--) 
  {
      x = kvp[i].split('=');
  
      if (x[0]==key)
      {
              x[1] = value;
              kvp[i] = x.join('=');
              break;
      }
  }
  
  if(i&lt;0) {kvp[kvp.length] = [key,value].join('=');}
  
  //this will reload the page, it's likely better to store this until finished
  
  document.location.hash = kvp.join('&amp;'); 
  }
  </code></pre>
  
  <p>I use it like this:</p>
  
  <pre><code>    insertParam("category",xy);
      insertParam("brand",zy);
  </code></pre>
  
  <p>My problem is it is decoding comma's to %2C. I know I can handle the characters on the server side, but how can I make it look pretty with javascript? By pretty I mean replace %2c with a comma.</p>