private string escape(string s)
{
StringBuilder sb = new StringBuilder();
byte[] ba = System.Text.Encoding.Unicode.GetBytes(s);
for (int i = 0; i < ba.Length; i += 2)
{
sb.Append("%u");
sb.Append(ba[i + 1].ToString("X2"));
sb.Append(ba[i].ToString("X2"));
}
return sb.ToString();
}
c#实现javascript escape
最新推荐文章于 2024-11-04 16:17:23 发布