http - Character encoding problems with tomcat -


I'm having trouble with character encoding for web applications. There is a pop up that queries the database with user input (search for a person by name). The problem is that the pronunciation characters are being transformed into weird letters such as ó = & gt; One ?? One ³ . This is a very simple problem but I can not understand what is happening.

What have I done?

Primarily, follow.

  • Setting the first filter on my Tomcat (The Request and Response) .setCharacterEncoding ("UTF-8");
  • Each Web.xml , server.xml character encoding parameter & lt ;? XML version = '1.0' encoding = 'utf-8'? & Gt; .
  • By changing the URIEncoding in UTF-8 in the connectors using Firebug, I already see that the content-type is set to text / html;
  • Change the meta type and change @page on the GPS UTF-8. P> But I still have one problem, though some have been resolved, for example For, some extant letters sent from the server to the customer are being displayed correctly.

    I have apache2.2 and tomcat 6 installed.

    I do not know what else to do and neither relevant information should be posted to me (please tell me if you need anything) ...

    Thank you in advance.

    Ensure that the encoding is also set at the database and the JDBC driver level. How to do this depends on the build / version of DB and JDBC driver. Consult the DB and JDBC driver specific documents for details. For example, for the MySQL JDBC driver, you need to add two specific parameters for JDBC Connection URL.

    By the way, there is no effect on setting up XML file encoding and the HTTP request / response encoding of the meta tag. For a JSP / Seral based web application, only the following should be configured:

    • For HTTP requests received, configure it at the server level. In Tomcat, this URI encoding attribute & lt; Connector & gt; is done by setting in Tomcat's server.xml .

    • For HTTP post requests, use a filter which is ServletRequest # setCharacterEncoding () .

    • By JSP generated for HTTP responses, and <%> page%> on the Per-JSP basis Set the page encoding attribute of, or better, set & lt; Page-Encoding & gt;

    • For HTTP responses generated by servlets (which does not include any JSP) in entry web.xml . !) ServletResponse # setCharacterEncoding () .

    • At least, make sure that your source code files are also saved as UTF-8 exact configuration depends on the editor to be used. In the case of Eclipse, you can make it window & gt; Properties & gt; General & gt; Workspace & gt; Text file encoding .

      Also see:


Comments