html - Do I really need to encode '&' as '&'? -


i'm using '&' symbol html5 , utf-8 in site's <title>. google shows ampersand fine on serps, browsers in titles.

http://validator.w3.org giving me this:

& did not start character reference. (& should have been escaped &amp;.)

do need &amp;?

i'm not fussed pages validating sake of validating, i'm curious hear people's opinions on , if it's important , why.

yes. error said, in html, attributes #pcdata meaning they're parsed. means can use character entities in attributes. using & wrong , if not lenient browsers , fact html not xhtml, break parsing. escape &amp; , fine.

html5 allows leave unescaped, when data follows not valid character reference. however, it's better escape instances of symbol worry ones should , ones don't need be.

keep point in mind; if you're not escaping & &amp;, it's bad enough data create (where code invalid), might not escaping tag delimiters, huge problem user-submitted data, lead html , script injection, cookie stealing , other exploits.

please escape code. save lot of trouble in future.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -