I have got a problem when i'm trying to send russian symbols from JSP to MySQL. After INSERT request it showes me something like in a pic(in name, surname field). But when i'm adding russian symbols streight to the database it showes normal. I tryed everything! Nothing helps.
This is my JSP page
<%@page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page pageEncoding="UTF-8" %>
<%@ page session="false"%>
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<fmt:requestEncoding value="utf-8"/>
<html>
<head>
<title>Registration Page</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link
href="<c:url value="/resources/registration/css/registration.css"/>"
rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/login/inputs/demo.css"/>"
rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/registration/inputs/set2.css"/>"
rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/registration/css/fontsReg.css"/>"
rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/registration/css/buttonsReg.css"/>"
rel="stylesheet" type="text/css">
<link href="<c:url value="/resources/login/inputs/normalize.css"/>"
rel="stylesheet" type="text/css">
</head>
<body class="bgrReg">
<div id="header">
<img src="<c:url value="/resources/logo/logo.png"/>"/>
</div>
<h2>Регистрация</h2>
<h5>(все поля обязательны к заполнению)</h5>
<div id="wrapper">
<div id="right_block">
<a href="login"><button class="slide_from_left">Назад</button></a>
</div>
<div id="left_block">
<c:url var="saveUrl" value="registration" />
<%
request.setCharacterEncoding("UTF-8");
%>
<form:form modelAttribute="users" method="POST" action="${saveUrl}"
class="formular">
<table>
<tr>
<td><span class="input input--manami"> <form:input
path="username" class="input__field input__field--manami"
type="text" id="input-32" /> <label
class="input__label input__label--manami" for="input-32">
<span class="input__label-content input__label-content--manami">Логин</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="password" class="input__field input__field--manami"
type="password" id="input-33" /> <label
class="input__label input__label--manami" for="input-33">
<span class="input__label-content input__label-content--manami">Пароль</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="name" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Имя</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="surname" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Фамилия</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="email" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Email</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:select
class="selectStyle" path="gender">
<form:option value="Мужской"></form:option>
<form:option value="Женский"></form:option>
</form:select></span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="age" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Возраст</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="weight" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Вес</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="height" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Рост</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"> <form:input
path="sport" class="input__field input__field--manami"
type="text" id="input-34" /> <label
class="input__label input__label--manami" for="input-34">
<span class="input__label-content input__label-content--manami">Спортивные
навыки</span>
</label>
</span></td>
</tr>
<tr>
<td><span class="input input--manami"><form:select
path="place">
<form:option value="Дзержинский"></form:option>
<form:option value="Киевский"></form:option>
<form:option value="Комминтерновский"></form:option>
<form:option value="Лененский"></form:option>
<form:option value="Московский"></form:option>
<form:option value="Октябрский"></form:option>
<form:option value="Орджоникидзевский"></form:option>
<form:option value="Фрунзенский"></form:option>
<form:option value="Холодная гора"></form:option>
<form:option value="Червонозаводской"></form:option>
</form:select></span></td>
</tr>
<tr>
<td><span class="input input--manami">
<button class="slide_from_left" type="submit">Регистрация</button>
<!-- <input type="submit"
value="<spring:message text="Регистрация"/>" /> -->
</span></td>
</tr>
</table>
<form:input path="enabled" type="hidden" value="true" />
</form:form>
</div>
</div>
</body>
</html>
This is my hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/spring_social_db?useUnicode=yes&characterEncoding=utf8</property>
<property name="hibernate.connection.characterEncoding">UTF-8</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.connection.CharSet">utf8</property>
<property name="hibernate.connection.characterEncoding">utf8</property>
<property name="hibernate.connection.useUnicode">true</property>
<mapping class="com.vandh.app.models.Users"/>
<mapping class="com.vandh.app.models.UserRole"/>
<mapping class="com.vandh.app.models.Feedback"/>
<!-- DB schema will be updated if needed -->
<!-- <property name="hbm2ddl.auto">update</property> -->
</session-factory>
</hibernate-configuration>
And this is my web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Sample Spring Maven Project</display-name><!-- Spring MVC -->
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-dispatcher-servlet.xml,
/WEB-INF/spring-security.xml
</param-value>
</context-param><!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy
</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
</web-app>
Help me pls! I don't know what to do! I have got no ideas!!! :(