About MySQL character encoding settings

Source: Internet
Author: User


Inserting data in MySQL always shows yes??? Garbled. Online very many people said that the test is not correct, later after a large number of inquiries, the solution is written in the following. Different version numbers have different ways of solving it. My database version number (5.5.40)

[Client]

Default-character-set=utf8
[MySQL]
Default-character-set=utf8
[Mysqld]
Collation-server = Utf8_unicode_ci
init-connect= ' SET NAMES utf8′

Character-set-server = UTF8


Updated: 2014-12-27

Later when inserting data with hibernate found that inserted into the MySQL database is garbled, so changed the database configuration, with the framework of spring MVC, in Web. Xml added filter, changed the code of the JSP page. It is good to find the display and insert the Chinese in the database directly with insert. Only when using Hibernate save to insert the database is garbled, and finally found that hibernate save operation is not practical UTF8 encoding.

I changed it in hibernate configuration file, such as the following

Jdbc.url=jdbc:mysql://58.210.161.122/fpp_alarm_client?

Createdatabaseifnotexist=true&useunicode=true&characterencoding=utf8&autoreconnect=true



About MySQL character encoding settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.