Coding related issues: Clearly is utf-8, why the display response is GBK?

Source: Internet
Author: User
Coding problem: Obviously utf-8, why the response is GBK?
Http://parttime.wengege.com/h/login.html

The response code is actually: Gbk,utf-8.

http/1.1 OK
server:nginx/1.4.1
Date:mon, June 15:28:28 GMT
content-type:text/html; Charset=gbk,utf-8
content-length:1843
Last-modified:mon, June 15:28:16 GMT
Connection:keep-alive
ETag: "5395d290-733"
Accept-ranges:bytes

This/login.html content is opened with EditPlus for Utf-8. Has also been saved as several times for Utf-8.

Where does it make the browser judge GBK? So garbled?

------Solution--------------------
Try a different editor, like Notepad or EmEditor.
------Solution--------------------
The contents of the HTTP header are declared in addition to the status codes.
If you
Header (' Content-type:text/html;charset=gbk,utf-8 ');
There will be content-type:text/html;charset=gbk,utf-8 in the HTTP cast.

PHP.ini's Default_charset
Httpd.conf's Default_charset
And so on, they can be set.
------Solution--------------------
It is estimated that the server is configured by default
I can't figure out what's wrong.

If there is no code that can be displayed properly on the same server, it should be a configuration issue.
If there is a normal code to change the normal code to the same content of this file, not normal to see the problem changed the sentence
The text changed to the normal display of the words with a 16 binary viewer compared to two files
------Solution--------------------
Nginx configuration problem? Test Apache for a second?
------Solution--------------------
After reading the above recovery, think of a problem.
Will not be set up in this catalogue. htaccess, set the default CharSet in. htaccess?
------Solution--------------------
No
. In htaccess
Adddefaultcharset GBK
Adddefaultcharset Utf-8
The result is content-type:text/html; Charset=utf-8
That only the last instruction is valid

It is, if
Adddefaultcharset Gbk,utf-8
then is content-type:text/html; Charset=gbk,utf-8.

So the problem goes back, the character set declaration is set, not the built-in



References: After
reading the above recovery, think of a problem.
Will not be set up in this catalogue. htaccess, set the default CharSet in. htaccess?

------Solution--------------------
Your JS file also has content-type:text/html; Charset=gbk,utf-8
Apparently, it's inside the Web server configuration file.
You find the GBK word in the server configuration file, you should be able to find it.

If you really don't want to find it, just add it in. htaccess
Adddefaultcharset Utf-8

It's covered with the original settings.
------Solution--------------------
You save when you choose No BOM and then try again, I grabbed the bag found your HTML has BOM header

New discovery: Have BOM header actually led to my browser, choose the coded menu dimmed?
  • 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.