In a link I have the {
and }
characters. In chrome/ff (and ie?), when I click that link it replaces {
with %7B
and }
with %7D
. Unfortunately, in opera it doesn't. If I URLEncoder.encode
the link, then %7B
becomes %257B
in the other browsers (so then I get a 404 @ that resource). So when I click the link in opera I get java.lang.IllegalArgumentException: Illegal character in path at index
. I'm confused about:
- Why doesn't opera encode
{
and}
? - Why throw an exception? Why not just encode the URL and continue?
- How to solve this without breaking the links (w/extra encoding) in other browsers?
Edit: we're using jersey, as it says in the stack trace:
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)