views:

151

answers:

1

I know that the EURO currency symbol (€) is encoded as € in HTML, but the System.Web.HttpUtility.HtmlEncode("€") doesnt encode it at all. Does anyone know why that is?

+4  A: 

HttpUtility.HtmlEncode only encodes characters that are "reserved" in HTML. For that list, see the first table on this page: http://www.w3schools.com/tags/ref_entities.asp.

In other words, only those characters that can conflict with the basic structre of HTML (e.g. <, >, ", etc). No other characters must be encoded as long as the encoding of the transmitted bytes is identified correctly (e.g. by using and declaring UTF-8).

Daniel Renshaw