title: URL encoding in java and decoding in javascript
body: <p>I have an URL to encode on my java serveur and then to decode with javascript.
  I try to retrieve a String I send in param with java. It is an error message from a form validation function.</p>
  
  <p>I do it like that (server side. Worker.doValidateForm() return a String) :</p>
  
  <pre><code>response.sendRedirect(URLEncoder.encode("form.html?" + Worker.doValidateForm(), "ISO-8859-1"));
  </code></pre>
  
  <p>Then, in my javascript, I do that :</p>
  
  <pre><code>function retrieveParam() {
      var error = window.location.search;
  
      decodeURIComponent(error);
      if(error)
          alert(error);
  }
  </code></pre>
  
  <p>Of course it doesn't work. Not the same encoding I guess.</p>
  
  <p>So my question is : which method can I use in Java to be able to decode my URL with javascript ?</p>