Solution to Apache forcing UTF-8 garbled characters in CentOS
The Centos system was not used much in the past. Later, the company's servers unified the operating system and all used Centos; So, naturally, I used yum to install services, which was very convenient, but the configuration of the services was not It’s very transparent, you need to explore it yourself-
- Then, I encountered a problem, as follows:
-
- Some of the company’s websites use UTF-8 encoding, and some use GBK. I found that when displayed on the page, The UTF encoding is normal, but the GBK encoding is garbled. At first, I thought it was because the system does not support GBK. After trying it, I found out that there was a problem with a setting of APACHE. After YUM was installed, the default encoding output was: utf -8
-
- And it is still forced to convert and will not change according to the METH set on your website page. This setting is AddDefaultCharset
-
- Method:
-
- AddDefaultCharset UTF-8 is changed to AddDefaultCharset OFF
-
-
- Result:
-
- Get it Work~ ~
-
-
- Summary:
-
- In retrospect, this kind of YUM installation is actually very convenient, but the configuration is indeed opaque and there is no documentation. It’s okay if there is no problem. If something goes wrong, it can’t be located quickly!
-
-
- Copy code
-
-
|