本文介绍了如何在HTML中显示汉字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用中文创建了网页。当我使用Google Chrome查看该页面时,所有中文字符都已损坏。我必须在HTML页面中添加内容吗?
解决方案
有两种方法可以定义页面的编码。您应该在< head>
标签中加入一个编码标签,以下是两种方法:
短路:
< meta charset =utf-8>
长途:
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8>
您可以在此问题中获得有关这两种方式之间差异的更多详细信息:
如果你想看到真实的例如,请查看源代码。
I have created web page using Chinese. When I view the page with Google chrome, all Chinese characters are corrupted. Do I have to add something in HTML page?
解决方案
There are two ways to define the encoding of your page. You should include inside your <head>
tags an encoding tag, two ways to do that follow below:
Short way:
<meta charset="utf-8">
Long way:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
You can have more details about the difference between these two ways in this question:
If you want to see a real example, take a look in the weibo.com source code at this line of code.
这篇关于如何在HTML中显示汉字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!