string s = "lw123abc测试信息!@#¥%……&*()——+";
Console.WriteLine("原数据:\t\t" + s);
String s2 = Uri.EscapeDataString(s);//Uri.EscapeDataString() 编码
Console.WriteLine("Hexdata:\t" + s2);
Console.WriteLine("data:\t\t" + Uri.UnescapeDataString(s2));//Uri.UnescapeDataString() 解码
效果