I generally HtmlEncode any user generated content that I render on my website, so ampersands etc. become & and so on, but was wondering, should this be done (from a standards point of view) to any dynamically generated meta descriptions, meta keywords etc throughout a site?
+3
A:
Absolutely. All content within the HTML document must be encoded this way.
Sean Reilly
2010-07-22 17:42:38
Thanks for the answers.
marcusstarnes
2010-07-22 18:01:34
A:
Yes. So for example quotes don't close the content attribute for a meta element which would trigger invalid HTML.
meder
2010-07-22 17:42:52
+1
A:
If you mean something like this:
<meta name="description" content="Some stuff, other stuff & even more stuff!" />
Yes, you need to encode the ampersand, and other special characters, to entities so your meta tags validate.
BoltClock
2010-07-22 17:43:08