简体   繁体   English

如果我使用UTF-8字符集,是否需要将HTML实体用于特殊字符?

[英]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. 我正在研究的网站正在从ISO转换。 If the HTML character set is set to UTF-8, do I still need to replace © , é , , etc with the appropriate HTML entity? 如果HTML字符集设置为UTF-8,是否仍需要用适当的HTML实体替换©é等?

No, symbols like © , é , , the German umlauts ä , ö , ü , ß and all the other stuff can be used just like any other character when using UTF-8. 不,使用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) 但请注意,有些内容仍然必须是实体,因为它们在HTML中具有特殊含义(例如, <> ,仍应替换为&gt;&lt;如果要在文本中使用它们)

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. 可能的遗留用法是在一些html页面链接和表单“获取”,但即使在这里,我们通常可以不用处理。

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. 如果你有用户在Windows上本地编辑文件而不是,那么毕竟坚持实体可能更安全。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTML-使用UTF-8或ISO-8859-1时,我仍然需要键入特殊字符的代码吗? - HTML - When using UTF-8 or ISO-8859-1 do I still need to type the codes for the special characters? 使用UTF-8时是否应该编码HTML特殊字符? - Should I encode HTML special characters when using UTF-8? 字符串中的问号,尽管我将`utf-8`用作字符集 - Question marks in string, Although I'm using `utf-8` as a charset 在使用charset = utf-8的HTML文件中,我是否还需要用ä替换变音符号? - In a HTML file with charset=utf-8, do I still need to replace umlauts with &auml;? 我还应该使用吗<meta charset="UTF-8"> 2022年? - Should I still be using <meta charset="UTF-8"> in 2022? 将重音符号和HTML实体转换为UTF-8? - Converting accented characters and HTML entities into UTF-8? 特殊字符“&gt;”不使用UTF-8显示 - Special Characters “>” not displaying by using UTF-8 我需要使用FreeMarker处理哪些特殊的html字符 - What special html characters do I need to handle with FreeMarker 我需要变量中的 HTML 特殊字符 - I need HTML special characters in variable 从MySQL输出的特殊字符可以正常工作,但是当我添加charset-utf8时却没有。 为什么? - Special characters outputed from MySQL works, but when I add charset-utf8 it doesnt. Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM