Do you often encounter garbled Chinese characters? How to fix the problem of garbled Chinese characters in HTML?
The lang attribute can specify the language type of the elements within the tag range. English lang="en", Chinese lang="zh", Japanese lang="ja".
Generally choose to specify English,
Cause of garbled code:
1. Mixed content of different encodings: HTML garbled code is caused by html encoding problems (common gb2312 and utf-8 Two encoding contents exist at the same time)
2. HTML encoding is not set: is not set, The setting here is utf-8
<html> <span style="white-space:pre"> </span><head><span style="white-space:pre"> </span><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
3. Use Notepad to edit html: Using Notepad to edit html directly can also easily result in html encoding garbled code
I use sublime, it is recommended to try as much as possible Use some editors such as notepad and sublime to reduce garbled characters.
The fundamental problem to avoid HTML garbled code is the encoding. First, set the encoding tag; second, use DW software to edit (modify) the web page file; third, when calling the data from the database during program development, it must be consistent with the HTML encoding. This can reduce or completely avoid HTML encoding garbled problems.