A 3 step method to apply UTF-8 encoding to J2EE applications.
1. Add the following directives to the page included in ALL jsps.
This will add request headers and meta-tags to every page served which will tell the browser that the page is utf-8 encoded.
2. Add a filter at server side to encode the request body received to UTF-8. A spring UTF-8 encoder (available in org.springframework.web*.jar of spring 3 distribution) if used, will have the following changes in web.xml:
3. Tell the container that the URLs too are to be encoded in UTF-8. In tomcat, this is done by adding the attribute URIEncoding=UTF-8 to the connector tag in server.xml. Else, this can also be done by setting useBodyEncodingForURI=true in the connector tag. This will tell the connector to use the same encoding used for the request body (set to UTF-8 in the previous steps.) This will make sure that the parameters received via GET requests too are properly understood by the application.