Home  >  Article  >  Web Front-end  >  Why is html Chinese garbled? How to solve garbled Chinese characters in html

Why is html Chinese garbled? How to solve garbled Chinese characters in html

云罗郡主
云罗郡主Original
2018-10-31 15:19:0249697browse

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:

Why is html Chinese garbled? How to solve garbled Chinese characters in html

#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!

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