开发者

What is the difference between the HTML codes Numeric and Friendly?

This page -- http://webdesign.about.com/od/localization/l/blhtmlcodes-punc.htm -- shows a list of HTML characters that can be rendered with either numeric codes or friendly codes. What is the difference between the two codes? Will some browsers render the codes d开发者_JS百科ifferently? Are the numeric codes more dependable and should therefore be the standard in HTML, XHTML, XML, etc.?

Thanks


No but in some circumstances, you will prefer one over the other.

If you generate HTML from Unicode, you don't want to remember all the nice entity names. Instead, you will always generate a numeric character entity.

If you write HTML code manually, you'll probably want to see right away what character this will become. Here, you will prefer the symbolic name.

For the HTML parsers, it doesn't make a difference. There is a standard which enumerates all the symbolic names plus a DTD file which contains them, so that's not a problem.

For XML parsers, things are a bit different. They don't know HTML entity by default. So you will have to add those. If you can't, then you will prefer HTML code that only contains numeric entities because any other input will make your code fail.


You simply cannot display all the available characters with "friendly" character sequences.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜