title: java.lang.IllegalArgumentException: Illegal character in path at index
body: <p>In a link I have the <code>{</code> and <code>}</code> characters.  In chrome/ff (and ie?), when I click that link it replaces <code>{</code> with <code>%7B</code> and <code>}</code> with <code>%7D</code>.  Unfortunately, in opera it doesn't.  If I <code>URLEncoder.encode</code> the link, then <code>%7B</code> becomes <code>%257B</code> in the other browsers (so then I get a 404 @ that resource).  So when I click the link in opera I get <code>java.lang.IllegalArgumentException: Illegal character in path at index</code>.  I'm confused about:</p>
  
  <ol>
  <li>Why doesn't opera encode <code>{</code> and <code>}</code>?</li>
  <li>Why throw an exception?  Why not just encode the URL and continue?</li>
  <li>How to solve this without breaking the links (w/extra encoding) in other browsers?</li>
  </ol>
  
  <p>Edit: we're using <a href="http://jersey.java.net/" rel="nofollow">jersey</a>, as it says in the stack trace:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Illegal character in path at index
      java.net.URI.create(URI.java:859)
      javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:95)
      com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:879)
      com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:843)
      com.sun.jersey.spi.container.servlet.ServletContainer.doFilter(ServletContainer.java:804)
  </code></pre>