I have an html-form with several text fields.

When I try to submit not English characters (Russian in my case) server is received "unreadable" string (not questions - "???" but some strange characters).

I simplified my code to show it here:

<%@ taglib uri="" prefix="c" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
  <head><title>Simple jsp page</title></head>
    <c:out value="${param.rustext}"/>
    <form action="/test" method="post">
        <input type="text" name="rustext" width="30">
        <input type="submit" value="Submit">

How should I fix that?

Was it helpful?


Tomcat uses ISO-8859-1 as the default character encoding for URL parameters, regardless of the encoding of the page that contains the URL. This can be changed with the "URIEncoding" attribute in its Connector configuration. Other application servers may have similar settings.

This article covers many problems commonly encountered when working with JSP.


Erickson explained this very well on this page. A server-independent solution is to use a character encoding filter, à la org.springframework.web.filter.CharacterEncodingFilter. See example below:

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class EncodingFilter implements Filter {
    private String encoding = "utf-8";
    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain filterChain) throws IOException, ServletException {
        filterChain.doFilter(request, response);
    public void init(FilterConfig filterConfig) throws ServletException {
        String encodingParam = filterConfig.getInitParameter("encoding");
        if (encodingParam != null) {
            encoding = encodingParam;
    public void destroy() {
        // nothing todo

In web.xml add the filter declaration and the filter url mapping in the appropriate sections:

    <![CDATA[Changes the encoding of the request, in order to help the appserver to correctly interpret request params]]>


When using POST - which is a must tu use encoding - the form is send as content-type "application/x-www-form-urlencoded". You may specify the form-attribute accept-charset="UTF-8" to specify your encoding.

This is the same as Victor Ionescu proposed, but you don't need to write your own encoding filter.

Add the following filter to web.xml


Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow