character encoding - Is it necessary to use — and – in XHTML or HTML5? -


it seems best use & escape, instead of typing ampersand (&).

however, should using x/html character entity references dashes , other common typographical characters when writing blog posts on cmss wordpress or hard-coding websites hand?

for example:

– en dash (–)

— em dash (—)

what risk if not?

why hyphen (-) never written - typed directly keyboard in html? (assuming hyphen, , not minus sign.)

the w3c released official response when use , when not use character escapes can find here. group in charge of html specification, think it's best follow advice.

from section "when use escapes"

syntax characters. there 3 characters should appear in content escapes, not interact syntax of markup. these part of language documents based on xml , html.

  • &lt; (<)

  • &gt; (>)

  • &amp; (&)

they mention using characters might not supported in current encoding.

from section "when not use escapes"

it preferable use encoding allows represent characters in normal form, rather using character entity references or ncrs.

using escapes can make difficult read , maintain source code, , can increase file size.

http://www.w3.org/international/questions/qa-escapes


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -