自定义的网页加密与解密
曾记得自己为了乱码而烦,后来发觉要调用一个加密解密的函数,今天看到别人项目里有两个这样的函数,不知是不是
网页里面那两个的原型,发觉挺有用的
/// <summary>
/// HTML编码
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string HtmlEncode(string input)
{
string sb = input;
sb = sb.Replace(" ", " ");
sb = sb.Replace("\n", "<br>");
return sb;
}
/// <summary>
/// HTML编码
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string HtmlDecode(string input)
{
string sb = input;
sb = sb.Replace(" ", " ");
sb = sb.Replace("<br>", "\n");
return sb;
}