我是否需要将 MetaTag http-equiv 与 DTD XHTML 1.0 Transitional//EN 一起使用?
我使用ASP.net 在我的文档中,我使用:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
我想知道是否有必要添加此元标记:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
感谢您对此的关注。
I use Asp.net
In my document I use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I would like to know if is necessary to add also this MetaTag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Thanks for your tme on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该添加元标记,但这不是强制性的。
DOCTYPE
不会自动告诉您字符集是什么,因此您应该添加文件编码为UTF-8
的信息。您还应该确保
content-type
HTTP 标头也设置为UTF-8
。You should add the meta tag, though it is not compulsory.
The
DOCTYPE
doesn't not automatically tell you what the character set is, so you should add the information that the file is encoded asUTF-8
.You should also ensure the
content-type
HTTP header is also set toUTF-8
.文档类型定义
请参阅参考:
http://www.w3.org/QA/Tips/Doctype
http://www.w3.org/TR/html4/struct/global.html
字符编码
请参阅参考资料 http://www.w3.org /International/O-charset
两者都是必要的,但并不相互依赖。
Doctype Definition
See the reference:
http://www.w3.org/QA/Tips/Doctype
http://www.w3.org/TR/html4/struct/global.html
Character Encoding
See The Reference http://www.w3.org/International/O-charset
Both are necessary, but not dependent to each other.
是的,添加这一点完全没问题,只需确保文件扩展名具有 .aspx 或附加的任何内容即可。
带有 html 的 ASP 页面示例:
希望这会有所帮助。
Yes this is perfectly fine to add that just make sure the file extension has .aspx or whatever attached to it.
Example ASP page with html:
Hope this helps.