How to enable Apache to support multiple types of encoding: gb2312 and UTF-8

Source: Internet
Author: User
Transferred from: http://hi.baidu.com/xxjyz/blog/item/e9b6c50212cc2281d43f7cbb.html2009-09-06
Recently, it takes a long time for the server to solve the problem, especially the encoding problem. What the transfer server is most afraid of is this problem, in addition, since each session is managed by a different person, it is impossible to hand over work, so we often have to rely on ourselves. There has never been a good solution. Today, I encountered another problem. A website is abnormal. I read the information he gave me.Code, 10.7 m, my mom. It's not killing me! After reading it carefully, the person who wrote this website is still quite kind. There is a common. php which has been modified. No, but it crashes. Initially, I suspect that the code was written in UTF-8, but it seems that I cannot change the Meta (I am not sure, because I have encountered similar situations before, you can only search on the Internet. And it is easy to modify.

Open the Apache configuration file and findAdddefacharcharsetComment out the line gb2312 (or adddefaultcharset UTF-8) and add adddefacharcharset off to disable the default character set, in this way, Apache can select the character set based on the meta information on the webpage. It is a good method. After modification, the Service httpd restart will be done.

P.s is still scared because there are more than N Large and small websites on the server of the school, all written by different people. If any fairy did not write meta information, it would take a while, you can only pray to heaven. However, this method can still be used later.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.