Phpmyadmin: utf8_general_ci: Chinese garbled text

Source: Internet
Author: User
Tags one more line
I have been writing PHP for more than a year, but I still cannot solve the encoding problem. my situation is like this. the webpage is completely normal, and Chinese garbled characters are displayed in The phpmyadmin database, whether it's in simplified or traditional Chinese, as long as the Chinese characters are garbled, I 've been writing PHP for more than a year, but the encoding problem is always not well solved. this is my case,

The webpage is completely normal, and Chinese garbled characters are displayed in The phpmyadmin database, either in simplified or traditional Chinese, as long as they are displayed in the following format -... Æ ¸

However, the webpage compiled by myself is displayed completely normal, no matter in traditional Chinese or simplified Chinese, it will not be garbled.

Of course, my webpage is saved in UTF-8 format, and the mysql_query ("set names 'utf-8'") statement is added when I read the database, so what you see on the webpage is completely normal. of course, it is only garbled in phpmyadmin. if you see here, the webpage is garbled, as I said,Save the webpage in notepad as UTF-8 format and specify Then, add mysql_query ("set names 'utf-8'") when reading the database. no garbled characters will occur. of course, the database, data table, and fields must also be savedUtf8_general_ci encoded formatThrough the above operations, there will be no garbled characters in the web page. today I will describe the problem of garbled characters in phpmyadmin,This is a final article about garbled text. after reading this article, garbled text will no longer appear in our programs and databases.

After reading the text, you will never see garbled text on the webpage. However, it takes a day to display Chinese characters in phpmyadmin, analyze your own code, encoding format, and phpmyadmin encoding format. search for GG and ask advanced technical staff. of course, it is better to seek help, after slowly analyzing the encoding problem, I finally found out why I am displaying garbled characters in phpmyadmin. if you want to learn more about the encoding problem, we will not bother you with garbled text in the future. check the two differences:Utf8 and UTF-8Don't look at him. he only has one more line. when there is a poor line, it will make your phpmyadmin garbled. well, analyze your own garbled situation and change the red part, the following are the methods to prevent garbled text, including the garbled text in the web page and phpmyadmin:

1. save all webpages in notepad as UTF-8 ,:

Note: ANSI is applicable to BIG5 and GBK

2. specify Encoding format, which is relatively simple and not described here

3. add mysql_query ("set names 'utf8'") to database operations. you can see that it is utf8, not utf-8. if it is related to the first line, UTF-8 will cause garbled characters in phpmyadmin, I have been writing a program for more than a year, and I have been using UTF-8. it has been in garbled format in phpmyadmin. now I have switched back to utf8 and finally fixed the problem of Chinese garbled characters in phpmyadmin,Note that after you change it to utf8, all the Chinese characters you read into the database on the webpage will be garbled. if there is a lot of content, do not change it. at most, phpmyadmin is garbled, the display on the webpage is always normal. here it is changed to utf8, which will be used for program development in the future. all phpmyadmin will be displayed normally. for the garbled question, 88.

4. the database encoding format isUtf8_general_ci,Table format is alsoUtf8_general_ci,Chinese fields are also usedUtf8_general_ci,See phpmyadmin's load map:

The above isUtf8_general_ci,Then, the field carrying diagram is as follows:

Well, we will not see garbled characters again when we use utf8 encoding for these steps. for original articles, please note

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.