UTF-8 and GB2312 web encoding

UTF-8 and GB2312 web encoding

Recently, many students have asked me about web page encoding. What is the difference between gb2312 and utf-8 encoding? Let’s summarize today.
Recently, many students have asked me about web page encoding. What is the difference between gb2312 and utf-8 encoding? Today's summary:
I don't know if you have ever encountered the problem of style definition not taking effect when making a page. The basic manifestation is that no matter how you change the style, it will not be displayed or only some browsers will work properly. At this time, 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 that the path in the file is correct (maybe you wrote too much or too little by mistake)
If both of the above points are confirmed to be ok or only part of the styles are invalid, it can be basically determined that it is a problem with the file encoding. Everyone knows that using "UTF-8" is more cross-platform compatible than "GB2312", but they may not know that the file encoding and the file encoding declaration are not the same thing. They think that as long as the file encoding type is declared, the file encoding is changed. As a result, many times the file encoding type is simply declared, but the file encoding type is not actually changed. When the browser parses the file with the declared encoding type, the actual encoding of the file is different from the declaration, resulting in incorrect parsing.
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 encodings of the two files are different. The above problem can be solved by saving another copy and selecting the same encoding type as the declaration.
If the above methods do not work, it may be a problem with the editing software. It is recommended to try another editor.
The editors I know of that may have problems are:
EmEditor Professional v7.50 Alpha 5 (Maybe it's due to the Alpha version. When UTF-8 is not signed, if there are specific Chinese characters at the end of the style comment, such as "不、用、接、名、近、见、鬼、评、论、的、出、写、下、现、面、日", the subsequent content cannot be parsed by IE7)
Editplus (I don't know which version it is. If anyone knows please tell me. When saving UTF-8 and adding a signature, the signature will cause the content to be unable to be parsed)
Note: The above refers to the style part, including the style in the page and the independent style file.

<<:  Node.js returns different data according to different request paths.

>>:  How to migrate the data directory in mysql8.0.20

Recommend

Vue calls the PC camera to realize the photo function

This article example shares the specific code of ...

Steps to package and release the Vue project

Table of contents 1. Transition from development ...

Analysis and summary of the impact of MySQL transactions on efficiency

1. Database transactions will reduce database per...

How to deploy Vue project using Docker image + nginx

1. Packaging Vue project Enter the following name...

How to Monitor Linux Memory Usage Using Bash Script

Preface There are many open source monitoring too...

How to configure nginx to return text or json

Sometimes when requesting certain interfaces, you...

Detailed tutorial on installing MySQL 8.0.20 database on CentOS 7

Related reading: MySQL8.0.20 installation tutoria...

How to build DockerHub yourself

The Docker Hub we used earlier is provided by Doc...

Example code for implementing transparent gradient effects with CSS

The title images on Zhihu Discovery columns are g...

Vue3 encapsulates its own paging component

This article example shares the specific code of ...

How to use html css to control div or table to be fixed in a specified position

CSS CodeCopy content to clipboard .bottomTable{ b...

Detailed explanation of the use and precautions of crontab under Linux

Crontab is a command used to set up periodic exec...