The ultimate solution of garbled problem in Linux system

Source: Internet
Author: User
Tags character set create database

Under the Linux construction site, garbled problem bothered me for almost one weeks, and then finally resolved.

My experience is that the application must conform to the character set (encoding) of the database.

Specifically, that is, if you want to use gb2312 encoding, it is necessary to ensure that each JSP file is stored in gb2312 encoding (select GB2312 encoding when you save the file), in addition, the file header is defined; For databases, you define encodings when you create a database, for example: Create DATABASE MySQL default character set gb2312 collate gb2312_chinese_ci; the last thing to do is, when connecting data, add the following code to the related file:

useunicode=true&characterencoding=gb2312.

To add that is, in the Linux, in fact, do not choose gb2312, I have used is utf8, of course, also need to follow the above steps to set up, will not appear garbled! Personal preferences, we feel free!

Before I tried a lot of methods, such as in the/etc/sysconfig/i18n file to change the system font, in the/ETC/MY.CNF [mysqld] field after adding the following statement default-character-set=gb2312 and so on, I think there is no need.

The above steps seem very simple, but my failure lesson is also my success experience. Now share with you, look after the harvest, not the top is your unkind!

Forget, there is also a key point, JDBC must use the appropriate version, before I used the 3.0.9, found no, and then replaced 3.0.16, no problem.

Related Article

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.