UTF-8 and GB2312 web page encoding_HTML/Xhtml_web page production
- WBOYOriginal
- 2016-05-16 16:43:331831browse
Recently, many students have asked me about the encoding of web pages. What is the difference between gb2312 and utf-8 encoding? Summarize today.
Many students have recently asked me about the encoding of web pages. What is the difference between gb2312 and utf-8 encoding? To summarize today:
I don’t know if you will encounter the problem of style definition not taking effect when making pages. The basic manifestation is that no matter how you change the style, it is not displayed or only some browsers work properly. In this case, you usually need to do the following steps :
Confirm whether the modified style file is the style file of the current page (in the case of multiple environments)
Confirm whether the path in the file is correct (you may have written more or less by mistake)
If the above two points confirm that there is no problem or only part of the style is invalid, it can basically be determined that the encoding problem of the file is
Everyone knows that using "UTF-8" has better cross-platform compatibility than "GB2312", but they don't necessarily know that the encoding of the file is not the same as the declaration of the file encoding. They think that as long as the encoding type of the file is declared, it is Changing the encoding of the file often simply declares the encoding type of the file without actually modifying the file encoding type. When the browser parses the file with the declared encoding type, the actual encoding of the file is different from the declaration. , an incorrect parsing problem occurs.
How do the above problems arise?
Only the declaration was modified, and the file encoding type corresponding to the declaration was not saved.
When copying between different files, the encoding between the two files is different.
The above problem can be solved by just saving another copy and selecting the same encoding type as the declaration.
If none of the above methods work, it may be a problem with the editing software. It is recommended to try another editor.
The editors that I know currently have problems:
EmEditor Professional v7.50 Alpha 5 (It may still be related to the Alpha version. When UTF-8 is not signed, if specific Chinese characters appear at the end of the style comment, such as "不,用,connection,name,near,see," "Ghost, comment, comment, of, out, write, next, now, face, day", etc. will cause the subsequent content to be unable to be parsed by IE7)
Editplus (I don’t know which version it is. If anyone knows, please tell me. When saving UTF-8 with a signature, the signature will cause the content to not be parsed)
Note: The above all refers to the style part, including the styles in the page and independent style files.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn