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

Summary of web design experience and skills

■ Website theme planning Be careful not to make yo...

Detailed steps to install Sogou input method on Ubuntu 20.04

1. Install Fcitx input framework Related dependen...

Using MySQL database in docker to achieve LAN access

1. Get the mysql image docker pull mysql:5.6 Note...

Differences between ES6 inheritance and ES5 inheritance in js

Table of contents Inheritance ES5 prototype inher...

Introduction to new features of ECMAscript

Table of contents 1. Default values ​​for functio...

How familiar are you with pure HTML tags?

The following HTML tags basically include all exis...

How to set Tomcat as an automatically started service? The quickest way

Set Tomcat to automatically start the service: I ...

Guide to using env in vue cli

Table of contents Preface Introduction-Official E...

CSS uses radial-gradient to implement coupon styles

This article will introduce how to use radial-gra...

Detailed steps for manually configuring the IP address in Linux

Table of contents 1. Enter the network card confi...

Understanding and application scenarios of enumeration types in TypeScript

Table of contents 1. What is 2. Use Numeric Enume...

The implementation principle of Tomcat correcting the JDK native thread pool bug

To improve processing power and concurrency, Web ...

4 principles for clean and beautiful web design

This article will discuss these 4 principles as t...

An example of using Dapr to simplify microservices from scratch

Table of contents Preface 1. Install Docker 2. In...