For the same mysql Data Source and the same browser, there is no garbled code for accessing the online test, and there is garbled code for accessing localhost. I think this is a problem with the server environment? Note: Chinese characters are displayed normally in mysql. Supplement: local and test server php. in ini, all default_charset values are commented out... for the same mysql Data Source and the same browser, there is no garbled code for accessing the online test, and there is garbled code for accessing localhost. I think this is a problem with the server environment?
Note: Chinese characters are displayed normally in mysql.
Supplement: local and test server php. inidefault_charset
All are commented out.
Supplement: my bad, I used to think it should not be the problem of setting character encoding in mysql (based on the same Code). When I try to specify character encoding, the problem can be solved. Generally speaking, there are three Encoding Problems: php, mysql, and browser settings.
Reply content:
For the same mysql Data Source and the same browser, there is no garbled code for accessing the online test, and there is garbled code for accessing localhost. I think this is a problem with the server environment?
Note: Chinese characters are displayed normally in mysql.
Supplement: local and test server php. inidefault_charset
All are commented out.
Supplement: my bad, I used to think it should not be the problem of setting character encoding in mysql (based on the same Code). When I try to specify character encoding, the problem can be solved. Generally speaking, there are three Encoding Problems: php, mysql, and browser settings.
According to your statement, since the database is the same, the browser is the same, and the code is certainly the same, the problem basically lies in php,
1. Check whether the default encoding of your php configuration is UTF-8. You 'd better check it with phpinfo ().
default_charset = "utf-8";
2. Check whether the encoding rules are set in the connection abstraction layer of your database where php interacts with MySQL. If mysqli is used, at least set it like this.
$mysqli->set_charset("utf8")
1. Does the head of the HTML document specify the same encoding as that specified by the backend handler?
2. Check whether the encoding of the table or field in the database is consistent with that of the back-end program (if it is inconsistent, for example, forced conversion of GBK UTF-8 may cause garbled code ).