Problem description In the CentOS system, GBK-encoded programs installed using the Apache server appear to have garbled characters. This is mainly because the character encoding of the Apache server installed by default is UTF-8. If there is no forced encoding in the GBK program, garbled characters will appear.
Solution
1. Open the Apache configuration file httpd.conf, such as /etc/httpd/conf/httpd.conf
# vi /etc/httpd/conf/httpd.conf
2, find the AddDefaultCharset configuration item
AddDefaultCharset UTF-8
3. Modify the AddDefaultCharset configuration and turn off the configuration characters, as follows
AddDefaultCharset Off
4, you can also set the default encoding of Apache to GB2312 as follows
AddDefaultCharset GB2312