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!