title: Correctly encoded string gets decoded when pushed into window.location.hash
body: <p><strong>The goal:</strong> Correctly put a string from a <code>data</code> attribute into the <code>window.location.hash</code>.</p>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>map = {path: $(this).attr('data-path'), rev: $(this).attr('data-rev')};
  window.location.hash = getMapParams(map);
  
  function getMapParams(map) {
    s="";
    for(key in map) {
      value=eval("map."+key);
      if (s.length &gt; 0) {
        s+="&amp;";
      }
      s+=encodeURIComponent(key)+"="+encodeURIComponent(value);
    }
    return s;
  }
  </code></pre>
  
  <p><strong>The problem:</strong> As soon as the <code>data-path</code> attribute contains a space Firefox fails to put the hash correctly. The space will appear unencoded whereas in other browsers it's correctly encoded as <code>%20</code>.</p>
  
  <p><strong>The weird quirks:</strong> If I debug the code the string is listed <em>with</em> the encoded space.</p>
  
  <p><strong>The research done:</strong> I have found plenty solutions for correctly <em>reading</em> the hash in firefox. In one way or another this is working fine with my code.</p>
  
  <p><strong>The question:</strong> How do I stop Firefox from urldecoding the space(s) in a string I put in window.location.hash</p>