Let’s talk about CSS UTF-8 and GB2312 encoding issues
Author:Eve Cole
Update Time:2009-06-06 18:41:25
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, the file has been changed. encoding, resulting in many times simply declaring the encoding type of the file without actually modifying the file encoding type. When the browser parses the file with the declared encoding type, because the actual encoding of the file is different from the declaration, a parsing error occurs. Incorrect question.
How did 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 of so far that may cause problems are:
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 "不,用,交,名,Nearly,见,鬼, Comment" , on, of, out, write, next, present, 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 refers to the style part, including the styles in the page and independent style files.