Why the local test after the normal upload will appear inserted database garbled solution idea
Source: Internet
Author: User
Why the local test will appear after the normal upload database is inserted garbled
Php+sql before and after the UTF8 local all normal upload after reading is normal but inserted into the database through the page Chinese is a question mark what's going on?
Each page is set up with
Each time you connect to the database, you set the
$DBH->exec ("Set CHARACTER set UTF8");
MySQL database tables and the encoding of each field are UTF8_GENERATE_CI
Local all normal upload to server inserted Chinese characters are all question marks
Somebody help me, it's almost crying.
------Solution--------------------
Mssql? Well, the direction is on the coding problem. But MySQL is set names ' UTF8 ', mssql I don't know. It's supposed to be an abnormal sentence.
------Solution--------------------
Explore
Reference:
Mssql? Well, the direction is on the coding problem. But MySQL is set names ' UTF8 ', mssql I don't know. It's supposed to be an abnormal sentence.
is MySQL exec ("Set CHARACTER set UTF8"); This method is correct I set the set names ' UTF8 ' it's useless. I'm crying.
------Solution--------------------
See if the encoding format exported from the local database is all UTF-8, and if so, the Chinese content after export is not a question mark, And then import to the server over there is not the encoding of the database is UTF-8. Should be the reason for inconsistent format, and then the upstairs said should be the MySQL bar, the statement should be mysql_query ("SET NAMES ' Utf-8 '");
------Solution--------------------
PHP page plus try:
Header (' Content-type:text/html;charset=utf-8 ');
------Solution--------------------
Or ox Brother Eye, I wrote in front of the wrong, is utf8! You phpadmin on the homepage to see MySQL connection proofing is not utf8_generate_ci
There is language is not the Chinese-chinese simplified, if all is not the point to export, and then see the file character set is not utf8, if so, you point the following execution, so that the data can be exported, And then it's important to see if the 3 items are consistent with your export, so it should be.
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