开发者

ASP.NET Server.HtmlEncode Won't Encode €

开发者 https://www.devze.com 2022-12-30 16:00 出处:网络
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?H

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

精彩评论

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

关注公众号