Database storage Chinese garbled problem

Reasons for garbled characters: (1) The MySQL encoding format is utf8, which is different from the PHP page format;

     (2) The field type is not utf8 when MySQL creates a table

     (3) mysql_query() does not specify the encoding method when connecting to the database

Solution: (1) The code of HTML file and PHP part should be set to utf8 format

     (2) The fields of the database table should be set to utf8_general_ci

       (3)mysql_query("set names utf8")

Guess you like

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