title: Problems with UTF-8 encoding, JSP, jQuery, Spring
body: <p>I have a web app with spring,jsp and jquery in a apache tomcat 6, one jsp page has a form that send the data with a ajax call made whit jquery, to a Spring MultiActionController on my back end.</p>
  
  <p>The problem is with the UTF-8 strings in the form inputs.</p>
  
  <p>I already did the following things:</p>
  
  <p>On my HTML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %&gt;
  &lt;%@ page contentType="text/html; charset=utf-8" %&gt;
  &lt;%@ page language="java" pageEncoding="utf-8"%&gt;
  
  &lt;html&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; 
  &lt;head&gt; 
  .
  .
  </code></pre>
  
  <p>On the jquery ajax call:</p>
  
  <pre><code>$.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/x-www-form-urlencoded; charset=UTF-8" });
      $.ajax(
          {
              type: "GET",
              url: "./saveData.action",
              contentType: "charset=utf-8",
              data: { name: $('#name').val(),...
  </code></pre>
  
  <p>On the tomcat server.xml:</p>
  
  <pre><code>&lt;Connector connectionTimeout="20000" port="8080" URIEncoding="UTF-8" protocol="HTTP/1.1" redirectPort="8443"/&gt;
  </code></pre>
  
  <p>On the MultiActionController</p>
  
  <pre><code>public ModelAndView saveData(HttpServletRequest request,HttpServletResponse response) 
      throws ServletException, IOException 
      {
          request.setCharacterEncoding("UTF-8");
          String name = request.getParameter("name");
  </code></pre>
  
  <p>So if in the name parameter I put something like this: </p>
  
  <blockquote>
    <p>María</p>
  </blockquote>
  
  <p>in the backend I get </p>
  
  <blockquote>
    <p>MarÃ­a.</p>
  </blockquote>
  
  <p>I already tried all the things that I read about, and I don't know what is the error, thanks for any help :)</p>