Home > Web Front-end > H5 Tutorial > body text

为什么有些网站的版权不用©而用©?

WBOY
Release: 2016-06-07 08:44:14
Original
2140 people have browsed it

例如百度、知乎

回复内容:

在页面的编码声明与客户端浏览器的编码识别都可靠的情况下(比如声明了 UTF-8,针对的也都是现代浏览器),对于外观明了且不必转义的字符,没有必要用 character reference(包括 character entity reference 与 numeric character reference)。对于特殊的空格以及各种不可见字符等外观不明了的情况,用 character reference 会方便维护代码。
当然,有时查找与输入特殊字符就很不方便,那么用 character reference 倒也方便输入,除此以外没什么好处。
另外,如果一定要用 numeric character reference,我建议用以 开头的十六进制格式,这样和 Unicode scalar value 一致,比较方便。 刚看了一下,知乎是©;百度首页是©;W3C是©;
目前发现唯一的差别就是字符长度不同,还有就是©;在指定不同编码下如gbk或utf-8下都能正确显示,©不能。
补充下,stackoverflow上的一个答案(貌似没有必要一定要用HTML字符实体?):

You don't generally need to use HTML character entities if your editor supports Unicode. Entities can be useful when:

  • Your keyboard does not support the character you need to type. For example, many keyboards do not have em-dash or the copyright symbol.
  • Your editor does not support Unicode (very common some years ago, but probably not today).
  • You want to make it explicit in the source what is happening. For example, the   code is clearer than the corresponding white space character.
  • You need to escape HTML special characters like
`©` 有 6 个字符,`©` 只有 1 个。 好看
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