For beginners, it is very simple to ask questions about Chinese garbled characters.

Source: Internet
Author: User
For beginners, it is very simple to ask the following questions about Chinese garbled characters. Cainiao inserts data on mysql workbench and uses php to extract and display data, however, Chinese characters are garbled in the browser.
Php uses UTF-8 on notepad ++ without BOM encoding.
Then the charset of the database is as follows:

I tried to set names utf8, set, alter table name convert to character set utf8. all Chinese characters in the browser are displayed ????, Question


Reply to discussion (solution)

Select the database and run the SETNAMES utf8 command.
If you are using mysql extension
Mysql_query ('set names utf8 ');

Select the database and run the SETNAMES utf8 command.
If you are using mysql extension
Mysql_query ('set names utf8 ');


Sorry, I don't seem to quite familiar with it. how can this problem be inserted?

Don't post your code if you don't understand it.
I already said: After selecting a database

You have the following code:
Mysql_connect ();
Mysql_select_db ('XXX ');
Mysql_query ('set names utf8'); // set the working character set here

Don't post your code if you don't understand it.
I already said: After selecting a database

You have the following code:
Mysql_connect ();
Mysql_select_db ('XXX ');
Mysql_query ('set names utf8'); // set the working character set here


Thanks to the moderator, you have been enthusiastic about the answer every time. although I don't know what the principle is, I have to say that I have to do this every time .. This is a little painful.

What is the principle?
It's easy. I use Chinese and you use Japanese, so we cannot communicate.
Now I will tell you: please translate Chinese
In this way, we can communicate with each other.

The answer of the moderator is really subtle. his profound questions are common and high.

What is the principle?
It's easy. I use Chinese and you use Japanese, so we cannot communicate.
Now I will tell you: please translate Chinese
In this way, we can communicate with each other.

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.