using System.Web; 引用system.web。
textBox2.Text = System.Web.HttpUtility.UrlDecode(textBox1.Text, System.Text.Encoding.GetEncoding("GB2312"));//将Url中的编码转换为简体汉字
textBox2.Text = System.Web.HttpUtility.UrlEncode(textBox1.Text, System.Text.Encoding.GetEncoding("GB2312"));//将简体汉字转换为Url编码
textBox2.Text = System.Web.HttpUtility.UrlDecode(textBox1.Text, System.Text.Encoding.GetEncoding("BIG5"));//将Url中的编码转换为繁体汉字
textBox2.Text = System.Web.HttpUtility.UrlEncode(textBox1.Text, System.Text.Encoding.GetEncoding("BIG5"));//将繁体汉字转换为Url
来源:https://www.cnblogs.com/q4002945/p/5934217.html