开发者

Do I need to use HTML entities for special characters if I'm using the UTF-8 charset?

A site I'm working on is switching from ISO. If the HTML character set is set to UTF-8, do I still need t开发者_运维问答o replace ©, é, , etc with the appropriate HTML entity?


No, symbols like ©, é, , the German umlauts ä, ö, ü, ß and all the other stuff can be used just like any other character when using UTF-8.

But note that some things still have to be entities because they have a special meaning in HTML ( < and > for example, which should still be replaced with &gt; and &lt; if you want to use them in your text)


in short : No you don't, actually I would even advise not to use them anymore. A possible legacy usage would be in some html pages links and forms "gets", but even here usually we can deal without.


Depends also on how you generate / edit your content. If you have users editing files locally on Windows and what not, it may be safer to stick to entities after all.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜