title: ISO-8859-1 encoded URL can't be correctly decoded by Servlet in Tomcat 8
body: <p>I have a Servlet as simple as this:</p>
  
  <pre><code>public class MyServlet extends HttpServlet {
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
          request.setAttribute("processedName", request.getParameter("name"));
          request.setAttribute("processedQueryString", request.getQueryString());
          request.getRequestDispatcher("index.jsp").forward(request, response);
      }
      protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          doGet(req, resp);
      }
  }
  </code></pre>
  
  <p>My <code>index.jsp</code> is like this:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;Title&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="MyServlet" method="get"&gt;
          Name: &lt;input type="text" name="name"&gt;
          &lt;input type="submit" value="Submit"&gt;
      &lt;/form&gt;
      &lt;br&gt;
      After: &lt;%=request.getAttribute("processedName") %&gt;
      &lt;br&gt;
      Query String: &lt;%=request.getAttribute("processedQueryString") %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If I type <code>Thomás</code> in the form and submit it, <code>Thom?s</code> is printed.</p>
  
  <p>Both the URL in browser and the query string in JSP show <code>name=Thom%E1s</code></p>
  
  <p>The browser is correctly encoding the ISO-8859-1 <code>á</code> char as <code>%E1</code>, but for some reason the <code>.getParameter</code> is not decoding it correctly.</p>
  
  <p>I've seen tons of posts like this here when people try to submit non ISO-8859-1 chars (unlike <code>á</code>). Shouldn't Tomcat 8 use ISO-8859-1 as default for decoding?</p>
  
  <p>Strangely, if I put <code>accept-charset="UTF-8"</code> in my form, it works. If I change the method to <code>method="post"</code> it works. If I mix both the <code>accept-charset="UTF-8"</code> and <code>method="post"</code> it doesn't work (but now <code>ThomÃ¡s</code> is printed!).</p>
  
  <p>It's as if Tomcat is waiting UTF-8 in get method and ISO-8859-1 in post method.</p>