title: how to use org.springframework.web.filter.CharacterEncodingFilter to correct character encoding?
body: <p>I need some help.</p>
  
  <p>I placed the code snippet below in my <code>web.xml</code>.</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter &lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;encoding&lt;/param-name&gt;
          &lt;param-value&gt;UTF-8&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;encodingFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>and in my <code>server.xml</code>:</p>
  
  <pre><code>&lt;Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/&gt;
  </code></pre>
  
  <p>My jsp pages are encoded as <code>UTF-8</code> and my mysql table is encoded as <code>utf8_general_ci</code>.</p>
  
  <p>My problem is that whenever I save a <code>ñ</code> it becomes <code>?</code>.</p>
  
  <p>When I tried to manually save <code>ñ</code> in the mysql terminal its saving properly. I suspect the problem lies within my server or my program. Please help.</p>