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

How to implement nginx smooth restart

1. Background During the server development proce...

5 Simple XHTML Web Forms for Web Design

Simple XHTML web form in web design 5. Technique ...

Summary of basic usage of $ symbol in Linux

Linux version: CentOS 7 [root@azfdbdfsdf230lqdg1b...

Canvas draws scratch card effect

This article shares the specific code for drawing...

Page Refactoring Skills - Javascript, CSS

About JS, CSS CSS: Stylesheet at the top Avoid CS...

What is the use of the enctype field when uploading files?

The enctype attribute of the FORM element specifie...

Use SQL statement to determine whether the record already exists before insert

Table of contents Determine whether a record alre...

Example of deploying Laravel application with Docker

The PHP base image used in this article is: php:7...

How to use localStorage in JavaScript

If you are a developer looking to get into the wo...

How to generate a free certificate using openssl

1: What is openssl? What is its function? What is...

14 Ways to Create Website Content That Engages Your Visitors

When I surf the Net, I often see web sites filled...

How to collect Nginx logs using Filebeat

Nginx logs can be used to analyze user address lo...

MySQL 5.7.27 installation and configuration method graphic tutorial

MySQL 5.7.27 detailed download, installation and ...