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
The effect is as follows:
We add the html encoding method to see the effect
The effect is as follows:
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!