views:

25

answers:

3

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
Thanks for the answers.
marcusstarnes
A: 

Yes. So for example quotes don't close the content attribute for a meta element which would trigger invalid HTML.

meder
+1  A: 

If you mean something like this:

<meta name="description" content="Some stuff, other stuff &amp; even more stuff!" />

Yes, you need to encode the ampersand, and other special characters, to entities so your meta tags validate.

BoltClock