On the lamp server, metacharset = gb2312 is set in html, and the browser request is still UTF-8. Why?

Source: Internet
Author: User
The default php encoding is commented out, and the default apache encoding is also changed. However, when the website is opened, it is still garbled? What is the reason? If you add a phpheader to the interface, the browser will be able to access it normally, but the program is an old program written by the predecessors and does not even have a unified portal, the actual environment for changing each file is php... the default php encoding is commented out, and the default apache encoding is also changed. However, when the website is opened, it is still garbled? Why?
If php header is added to the interface, the browser can access the interface normally, but the program is an old program written by the predecessors, and there is no unified entrance. It is unrealistic to change each file.
The environment is php5.6 and centos6.5.
There is no problem with the program on another server, and the windows local environment is okay.

Reply content:

The default php encoding is commented out, and the default apache encoding is also changed. However, when the website is opened, it is still garbled? Why?
If php header is added to the interface, the browser can access the interface normally, but the program is an old program written by the predecessors, and there is no unified entrance. It is unrealistic to change each file.
The environment is php5.6 and centos6.5.
There is no problem with the program on another server, and the windows local environment is okay.

After setting charset for meta, you also need to change the file encoding to ansi. Many file encoding tools are supported by general editors. I use Editplus, and there is a "file encoding" under the "document" menu, which can be modified. If charset = UTF-8, the file encoding is also UTF-8. The browser reads the file encoding by default, and the meta setting is generally not a priority.

Shouldn't html be set to UTF-8 ??

Not meta?

What is the browser code? Now the default browser is estimated to be UTF-8.
For example, when I write a new webpage encoded as gbk, It is garbled to open it in a browser, and chrome and Firefox are garbled.

In Chrome or ff f12, check whether content-type in the response header contains the character set you need. If not, check whether apache settings are appropriate.

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.