" statement to set the encoding method; 2. Use a web editor to open the HTML document and set the encoding to unify Encoding format for files and code."/> " statement to set the encoding method; 2. Use a web editor to open the HTML document and set the encoding to unify Encoding format for files and code.">

Home  >  Article  >  Web Front-end  >  How to solve Chinese garbled characters in html pages

How to solve Chinese garbled characters in html pages

青灯夜游
青灯夜游Original
2021-07-01 14:50:5434549browse

Solution to Chinese garbled characters: 1. In the head part of the HTML document, use the "" statement to set the encoding method; 2. Use a web editor to open the HTML document and set the encoding to unify the files. and the encoding format of the code.

How to solve Chinese garbled characters in html pages

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

Causes of garbled characters:

  • #An important factor that may cause Chinese garbled characters is that the web page may not have an encoding code set , or the encoding code was not found on the web page.

  • Different encoding content is mixed. For example, the code of html is utf-8 encoding, and the encoding of the content is gbk. When opened with a browser, garbled characters will appear.

  • Many browsers cannot automatically recognize the code of the web page, which will also cause garbled code.

Solution to Chinese garbled characters

1. If the encoding is not set in html, as long as we set it in html Just set a string of codes in the A page attribute, page encoding has an encoding sub-attribute, we can set it to the corresponding attribute, as shown in the figure:

Recommended tutorial: "

html Video tutorialHow to solve Chinese garbled characters in html pages

The above is the detailed content of How to solve Chinese garbled characters in html pages. 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