What about Chinese garbled when creating a website through Tomcat under Ubuntu?

  

In the Ubuntu system, there are users who have encountered garbled problems after setting up the Demo program under tomcat. After inserting the Chinese parameters of the input form into the database, it will display garbled characters. What is going on? What should I do if there is Chinese garbled on the website created by Tomcat under Ubuntu?

The essence of garbled characters is because the character set is not uniform. If the content character encoding and server encoding sent by your web browser to the server are inconsistent, then garbled characters will appear.

Solution:

(1) First unify the character encoding of the Linux server, unified configuration is utf-8.

(2) Configuration profiles tomcat server.xml, the

is configured to:

(3) mysql configuration database my.cnf, the The default character set is set to utf-8. Create the database after setting the database character set. Otherwise, the database character set information is inconsistent before and after, which will cause an insertion error.

The above is the solution to the Chinese garbled text created by Tomcat under Ubuntu. It only needs the simple steps of the above three steps to solve the garbled problem of Linux.

Copyright © Windows knowledge All Rights Reserved