An error occurred while importing mysql in Excel! (Urgent)

Source: Internet
Author: User
An error occurred while importing mysql in Excel! (Urgent) I have imported more than two thousand mysql records from Excel. What is terrible is that some data of traditional Chinese characters is also garbled. only in the page toolbar to view the selection of simplified Chinese database data will not be garbled, but the page of the Chinese characters (not read from the database) and become garbled, what UTF-8, GBK, I tried both GB2312 and it was garbled. either the Chinese characters on the page were garbled or the traditional Chinese character Excel file on the database was used to import mysql! (Urgent)
I have imported more than two thousand mysql records from Excel. What's worse is that some data of traditional Chinese characters is also garbled in PHP. only in the page toolbar to view the selection of simplified Chinese database data will not be garbled, but the page of the Chinese characters (not read from the database) and become garbled, what UTF-8, GBK, I tried GB2312, but it was still garbled. either the Chinese characters on the page are garbled or the traditional Chinese characters found in the database are garbled. Is there any way to write the code that will not be garbled once the page is opened, thank you!

------ Solution --------------------
Mysql_query ("set names big5 '");

Is this execution useless?
------ Solution --------------------

When importing a database
Mysql_query ("set names 'utf8 '");
In addition, we recommend that you convert all the data read from excel to UTF-8 and store the data in the database.

Mysql_query ("set names 'utf8 '");


------ Solution --------------------
Export an excel file to utf8
------ Solution --------------------
What is your environment and version?

Upload the demo file to help you write it ~~
------ Solution --------------------
Follow
------ Solution --------------------
I encountered garbled characters during export and changed the encoding to OK.

I don't know why ...............................
------ Solution --------------------
Discussion
Now the garbled problem is solved. first convert the Excel file into a UTF-8 txt file and then save it as a csv file, so that the imported file will be in UTF-8 format!
However, there is a new problem, that is, as long as the first character of each column to be imported is Chinese characters, the inserted database will be blank and the read will be blank, except that the first character in the column is not a Chinese character, it can be read and displayed. it is really dizzy. who knows what is going on? thank you!

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.