文字列のURLエンコード
System.Web.HttpUtilityを使う
using System.Web;
string origin = "あsdf<dsf>/df\"dsf<@.sdaf>あああああ"; Console.WriteLine(origin); string encoded = HttpUtility.HtmlEncode(origin); Console.WriteLine(encoded); string decoded = HttpUtility.HtmlDecode(encoded); Console.WriteLine(decoded); Console.WriteLine(decoded.Equals(origin));
あsdf<dsf>/df"dsf<@.sdaf>あああああ あsdf<dsf>/df"dsf<@.sdaf>あああああ あsdf<dsf>/df"dsf<@.sdaf>あああああ True