title: Cope with differences, using c# and javascript methods while encoding URI parts
body: <p>In my MVC applciation, sometimes I'm creating my querystring dynamically: once from javascript, and once from c# server code. In javascript, I'm using <code>encodeURIComponent(value)</code>, and from the c#, I'm using <code>HttpUtility.UrlEncode(value)</code> method from <code>System.Web</code></p>
  
  <p>Suppose, I have <em>space</em> in the <code>value</code>, ex: <strong>a q</strong>:</p>
  
  <ul>
  <li><code>encodeURIComponent(value)</code> returns <strong>a%20q</strong> </li>
  <li><code>HttpUtility.UrlEncode(value)</code> returns <strong>a+q</strong></li>
  </ul>
  
  <p>Space is encoded differently, using these two methods. Is that any reason why is it working this way, different that "it was written like that long time ago and stays untouched" ?</p>
  
  <p>Additionally, suppose I have <em>plus</em> in the <code>value</code>, ex: <strong>a+q</strong></p>
  
  <ul>
  <li><code>encodeURIComponent(value)</code> returns <strong>a%2Bq</strong></li>
  <li><code>HttpUtility.UrlEncode(value)</code> returns <strong>a%2bq</strong></li>
  </ul>
  
  <p>The js method returns upper case encoded characters, while c# one returns lower case ones.</p>
  
  <p>What is the best way to cooperate in parallel with these two methods, to make the application behave in coherent way ? Shall I write alternative c# method to imitate the js method behaviour ? I suppose the decoding methods has the same differences. Is there any "correct" way work with these ?</p>