开发者

ASP.NET Server.HtmlEncode Won't Encode €

I know that the EURO currency symbol (€) is encoded as € in HTML, but the System.Web.HttpUtility.HtmlEncode("€") doesn't encode i开发者_如何学编程t at all. Does anyone know why that is?


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜