颐和api

EncodingHelper.cs 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web;
  6. namespace MadRunFabric.Common
  7. {
  8. public static class EncodingHelper
  9. {
  10. /// <summary>
  11. /// 解码
  12. /// </summary>
  13. /// <param name="s"></param>
  14. /// <returns></returns>
  15. public static string HtmlDecode(string s)
  16. {
  17. //System.Net.WebUtility.HtmlDecode(s);
  18. return HttpUtility.HtmlDecode(s);
  19. }
  20. /// <summary>
  21. /// 编码
  22. /// </summary>
  23. /// <param name="s"></param>
  24. /// <returns></returns>
  25. public static string HtmlEncode(string s)
  26. {
  27. //System.Net.WebUtility.HtmlEncode(s);
  28. return HttpUtility.HtmlEncode(s);
  29. }
  30. public static string UrlDecode(string s)
  31. {
  32. return HttpUtility.UrlDecode(s);
  33. }
  34. public static string UrlEncode(string s)
  35. {
  36. return HttpUtility.UrlEncode(s);
  37. }
  38. }
  39. }