Home > Web Front-end > H5 Tutorial > Chinese garbled characters problem

Chinese garbled characters problem

大家讲道理
Release: 2017-05-28 10:43:26
Original
4538 people have browsed it

Today I encountered the problem of Chinese garbled characters while learning HTML5:


<body>
    <form >
    	请输入内容:
    	<input pattern="[A-Z]{3}" name="part">
    	<input type="submit">
    </form>
  </body>
Copy after login


I developed it using myeclipse 2016, but the encoding format of my project and html file are both utf-8, which is still garbled. I searched online. I couldn't find it in the search, but later I found an interesting thing and learned the cause of the problem.

Every time you create a new HTML5 file, the new file comes with the following code:


 <meta name="keywords" content="keyword1,keyword2,keyword3">
 <meta name="description" content="this is my page">
 <meta name="content-type" content="text/html; charset=UTF-8">
Copy after login


But I tried to change


 <meta name="content-type" content="text/html; charset=UTF-8">
Copy after login


to the following


<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
Copy after login


The problem of garbled characters is solved.

Then I went to google to find out the difference between http-equiv and name:

They said this: "nameattribute is mainly used to describe web pages", while http -equiv "is equivalent to the http file header. It can return some useful information to the browser to help display the web page content correctly and accurately."

After seeing this, I think it can be roughly explained, It’s just that you may need to change it every time in future development (I tried deleting all these meta attributes, but when the project was run, the Chinese characters were still garbled...).

The above is the detailed content of Chinese garbled characters problem. For more information, please follow other related articles on the PHP Chinese website!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template