Home > Web Front-end > HTML Tutorial > html garbled problem

html garbled problem

PHP中文网
Release: 2017-06-06 11:50:35
Original
1790 people have browsed it

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

- 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: 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" />
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template