Home  >  Article  >  Web Front-end  >  html garbled problem

html garbled problem

PHP中文网
PHP中文网Original
2017-06-06 11:50:351749browse

Do you often encounter garbled Chinese characters? How to fix the problem of garbled Chinese characters in HTML?

b1ab284f054a8e81770b7654e2337c09 - Specify the language type

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: 97f2b6ae5f4f65bc7d15c6c9b9e8be8c 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.

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