C# URL编码转换 URL转码 UrlDecode UrlEncode

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/sdxlz666/p/12445508.html