The program uses Spring-data-jpa, Tomcat, MySql, from the database the script successfully puts Russian letters into the database, everything is displayed on jsp. But if you need to add new data from the page or change it, any kind of kryakozyabry appears, as it is understood to be something bytecode. The problem is most likely with jsp encodings. It is written there:

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> 

On SOF did not find a solution. Of course I will look further, can anyone come across?

    3 answers 3

    Check the url by which you connect to the database, in the parameters you must specify the encoding. jdbc: mysql: // localhost: 3306 / bdname? useUnicode = true & characterEncoding = UTF-8 & characterSetResults = UTF-8

    • Yes, everything is correct, this is to add entries from the script to the database, otherwise there will also be kryakozyabry or question marks. - vinsler

    1) The page should contain a string of encoding, as written above:

     <%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> 

    2) Add to web.xml:

     <filter> <filter-name>encodingFilter</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>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 

    The solution from here helped

    3) It is not necessary to add a resolver to the java config, but you can:

     resolver.setContentType("text/html;charset=UTF-8"); 

    That's the whole problem.

      Look also in the Encoding development environment itself, select UTF-8 encoding.

      • This is also correct, the first thing in the project settings is to install everything to avoid possible further problems. - vinsler