Mysql Chinese garbled Solution

Source: Internet
Author: User


Mysql Chinese garbled detailed solution this is my previous iteye number, now put in this number, easy to sort out recently to do the graduation design, the previous database is oracle, basically, no Chinese garbled characters have been found. However, the graduation designer is out of the field and the laptops are relatively junk. oracle cannot afford them. An eclipse and a Firefox cpu have already run to 90%. So I decided to use the mysql database. Jsp is used at the front end, And UTF-8 is used for encoding. However, the Chinese garbled characters in mysql have plagued me for a long time. After some queries, we finally solved the problem. I. Check whether the programming environment is UTF-8. Right-click the project name and select "UTF-8" for the text file encoding. www.2cto.com 2: Set the encoding format of the jsp page: Method: contentType = "text/html; charset = UTF-8" meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "3: Set the encoding format of request and response: Method: response. setContentType ("text/html; charset = UTF-8"); request. setCharacterEncoding ("UTF-8"); 4: Write filter 5: Change the connection method to jdbc: mysql: // localhost/databasename? UseUnicode = true & amp; characterEncoding = UTF-8 after the above 5 steps, if the problem persists, it may occur on the mysql server. Www.2cto.com database aspect 1: First, check the database Character set setting method: set character_set_client = utf8; in this way, you can see several character sets. Then run the following command to modify set character_set_client = utf8; set character_set_connection = utf8; set character_set_database = utf8; set character = utf8; set character_set_server = utf8; of course, it can also be in, i. modify the character set in ini to utf8 www.2cto.com. In this step, the data retrieved from the database is basically Chinese, but problems may still occur, for example, when opened in dos, Chinese characters are still garbled and Chinese characters cannot be inserted using SQL statements in dos. Set character_set_results = utf8; set character_set_results = gbk; set character_set_client = utf8; set character_set_client = gbk; to solve the problem.

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.