title: Square brackets in URL causes exception in Tomcat
body: <p>I noticed the following exception is thrown in my Play! application running on Tomcat:</p>
  
  <pre><code>javax.servlet.ServletException: java.net.URISyntaxException: Illegal character in path at index 35: /K-NAAN/lyrics/Is-Anybody-Out-There[]-lyrics/3807088
      play.server.ServletWrapper.service(ServletWrapper.java:157)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  root cause
  
  java.net.URISyntaxException: Illegal character in path at index 35: /K-NAAN/lyrics/Is-Anybody-Out-There[]-lyrics/3807088
      java.net.URI$Parser.fail(Unknown Source)
      java.net.URI$Parser.checkChars(Unknown Source)
      java.net.URI$Parser.parseHierarchical(Unknown Source)
      java.net.URI$Parser.parse(Unknown Source)
      java.net.URI.&lt;init&gt;(Unknown Source)
      play.server.ServletWrapper.parseRequest(ServletWrapper.java:241)
      play.server.ServletWrapper.service(ServletWrapper.java:132)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  </code></pre>
  
  <p>According to <a href="https://stackoverflow.com/questions/40568/square-brackets-in-urls">this thread</a> square brackets aren't valid characters in an URI, and it's the client's responsibility to encode them? I get that exception in Chrome on MacOS, but not on Firefox, which seems to imply Chrome doesn't encode them. What's worse, I'm pretty sure googlebot also encounters that exception.</p>
  
  <p>What's the right course of action here?</p>
  
  <p>Can I tweak Tomcat to somehow accept or encode square brackets?  Or is it a bug or behavior in Play?</p>
  
  <p>Or should I just make sure that every single link to my pages has square brackets URL-encoded? Possible on my own website, of course, but not so much for external links.</p>