I work on Spring MVC + Hibernate application, use MySQL (ver. 5.0.51a) with the InnoDB engine.
The problem appears when I am sending a form with cyrillic characters. As the result, database contains senseless chars in unknown encoding.
All the JSP pages, database (+ tables and fields) created using UTF-8. Hibernate config also contains property which sets encoding to UTF-8.
I had solved this by creating filter which encodes request content with UTF-8. Exemplary code:
…
encoding = "UTF-8";
request.setCharacterEncoding(encoding);
chain.doFilter(request, response);
…
But it visibly slows down the app.
The interesting thing is that executing insert query directly from the app (i.e. running from Eclipse as Java Application) works perfect.
UPD.
As far as I understood, using filter is the only working solution in my case.
I didn't know about standard CharacterEncodingFilter. Use it now, works very well!
<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>
<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>