3

I'm adding some meta description data to my header like so:

HtmlMeta meta = new HtmlMeta();
meta.Name = "description";
meta.Content = description; // this is unencoded
page.Header.Controls.Add(meta);

And .net helpfully encodes things like & and <, but not >. Now, I can't imagine that this would be an oversight, so I conclude that it's unnecessary to escape them. But before I go back to the client with that answer, it would be nice to get confirmation by Some Strangers From The Intarwebs first :)

animuson
  • 53,861
  • 28
  • 137
  • 147
user568259
  • 343
  • 1
  • 7
  • 16
  • this is duplicate question, https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-in-html was first — no matter is it asp or whatever was used to generate the (H)TML spec is the same – revelt Jan 07 '20 at 14:01

1 Answers1

4

According to the XML specification > is indeed valid for attributes. Only <, & and " or ' need escaping.

[10]    AttValue    ::=    '"' ([^<&"] | Reference)* '"'
                         | "'" ([^<&'] | Reference)* "'"
Diadistis
  • 12,086
  • 1
  • 33
  • 55