Home > Article > Web Front-end > Why is html Chinese garbled? How to solve garbled Chinese characters in html
Many programmers will encounter garbled html files when developing websites. So, why is html Chinese garbled? What causes html garbled characters? How to solve the garbled Chinese characters in HTML? The following PHP experts will help you solve these problems.
1: Why is html Chinese garbled?
1. There are three encodings for web pages, gbk and utf-8, and the other is gb2312, which corresponds to different content The encodings are also different, but the commonly used encodings are gb2312 and utf-8.
2. An important factor that may cause Chinese garbled characters to appear is that the web page may not have an encoding code set, or the encoding code may not be found on the web page.
3. Many novices like to use Notepad to open html. Often, when opening files using html, garbled web pages will appear. The code of
4.html is encoded in utf-8, and the encoding of the content is gbk. When opened with a browser, garbled characters will appear.
5. Many browsers cannot automatically recognize the code of the web page. Will this cause errors?
2: How to solve the problem of Chinese garbled characters in html[Recommended reading:How to solve the problem of Chinese garbled characters in php? 】
1. If the encoding is not set in the html, we only need to set a string of codes in the html. For example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2 .Do not use Notepad to open html. Be sure to use a special web page editor to open it, especially UTF encoding. If you open and save it with Notepad, garbled characters will appear.
3. Use the dw software to set the encoding. In the dw software, there is a modification attribute at the top. The sub-attribute has a page attribute. The page encoding has an encoding sub-attribute. We can set it to the corresponding attribute. As shown in the picture:
#The above is why the Chinese html is garbled? A full introduction to how to solve garbled Chinese characters in html. If you want to know more about html tutorial, please pay attention to the php Chinese website.
The above is the detailed content of Why is html Chinese garbled? How to solve garbled Chinese characters in html. For more information, please follow other related articles on the PHP Chinese website!