XHTML 1.0 元数据中的字符实体?
对于具有 XHTML 1.0 Doctype 的页面上的标题、关键字和描述字段,非 ascii 字符(如 – é 等)的正确用法是什么?爬虫和社交媒体网站是否可以更好地将它们解读为:
<title>My webpage — a study in typesetting</title>
<meta name="description" content="A page about character entities in XHTML. Check my resumé if you don't believe me." />
或者:
<title>My webpage — a study in typesetting</title>
<meta name="description" content="A page about character entities in XHTML. Check my resumé if you don't believe me." />
For my title, keywords and description fields on a page with an XHTML 1.0 Doctype what is the correct usage for non-ascii characters like – é etcetera? Do crawlers and social media sites read them better as:
<title>My webpage — a study in typesetting</title>
<meta name="description" content="A page about character entities in XHTML. Check my resumé if you don't believe me." />
OR:
<title>My webpage — a study in typesetting</title>
<meta name="description" content="A page about character entities in XHTML. Check my resumé if you don't believe me." />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您最好坚持使用本机字符,但指定编码类型。对于国际字符集,坚持使用 UTF-8 是安全的:
You're best to stick to the native characters, but speficy the encoding type. for international charactersets, it's safe to stick with UTF-8:
如果您在 HTTP 标头(而不仅仅是 HTML 标头)中正确声明了字符集,那么它应该没有任何区别。
If you declared your character set correctly in the HTTP header (and not only the HTML head), then it should make absolutely no difference.