Home  >  Article  >  Web Front-end  >  Why is html Chinese garbled? How to deal with it?

Why is html Chinese garbled? How to deal with it?

不言
不言Original
2018-10-30 16:40:2225565browse

In web pages, we sometimes see a large string of Chinese garbled characters. So, why are these html Chinese garbled characters? How to solve these Chinese garbled characters? This article will share with you the solution to Chinese garbled characters in HTML.

First let’s take a lookWhy is html Chinese garbled?

The reason why html Chinese garbled characters is actually due to the html encoding problem. When the Chinese text content in the html source code is different from the html encoding, Chinese garbled characters will be caused.

Now that we know the reasons for the appearance of these Chinese garbled characters, let’s take a look at How to solve the problem of Chinese garbled characters in html

The encoding methods in html include gb2312, gbk, utf -8 three, we only need to add the html encoding method to the html code to solve the problem of garbled Chinese characters in html. As shown below, when we do not add the html encoding method to the code, Chinese garbled characters will appear

Why is html Chinese garbled? How to deal with it?

The effect is as follows:

Why is html Chinese garbled? How to deal with it?

We add the html encoding method to see the effect

Why is html Chinese garbled? How to deal with it?

The effect is as follows:

Why is html Chinese garbled? How to deal with it?

The Chinese garbled characters will be gone.

Note: The editor used in this article is sublime text. Students who need to download it can go to the php Chinese website Tool Download to download it.

The above is the detailed content of Why is html Chinese garbled? How to deal with it?. For more information, please follow other related articles on the PHP Chinese website!

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