一、C#中的编码

HttpUtility.HtmlDecode、HttpUtility.HtmlEncodeServer.HtmlDecode、Server.HtmlEncodeHttpServerUtility.HtmlDecodeHttpServerUtility.HtmlEncode的区别?

它们与下面一般手工写的代码有什么区别?

public static string htmlencode(string str)  
{  
    if (str == null || str == "")  
        return "";  
  
    str.Replace("<", "<");  
    str.Replace(">", ">");  
    str.Replace(" ", " ");  
    str.Replace(" ", "  ");  
    str.Replace("/"", """);  
    str.Replace("/'", "'");  
    str.Replace("/n", "<br/>");  
  
    return str;  
}  
[c-sharp]

相关文章:

  • 2021-09-09
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-01-15
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案