Home > Article > Backend Development > About the problem of garbled characters in Mysql5_PHP tutorial
I have been exposed to Mysql5 several times before, but I have been using 4.0 because the Chinese garbled characters cannot be solved. Mysql5 supports multiple encoding methods. As long as the encoding stored and read are consistent, garbled characters will not be generated, for example, both are gb2312.
1. Specify the encoding gb2312
in the web page
It is best to execute it before executing the SQL statement:
mysql_query("SET NAMES GB2312");
2. Modify the apache configuration file httpd.conf
AddDefaultCharset GB2312
3. Modify mysql5 configuration file
default_character_set = gb2312
This method was successfully tested under FC5 and Windows XP.