The solution for all Chinese inserted into the database becomes a question mark

Summary: If there are garbled characters inserted in Chinese, there are no more than the following three types: the encoding method of the database (database character set), the encoding method of the table, and the encoding method of the columns in the table.

mysql command:

show variables like '%char%' ;


Modify the encoding format of the table

ALTER TABLE `table` DEFAULT CHARACTER SET utf8;  

Modify the encoding format of the field

ALTER TABLE `tablename` CHANGE `fieldname1` `fieldname2` VARCHAR(36) CHARACTER SET utf8 NOT NULL;  


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324688585&siteId=291194637