So it is probably just ANSI encoding, so try
var secureString = new SecureString();
foreach (var b in Encoding.Default.GetBytes("C# test's file"))
secureString.AppendChar((char)b);
var stringResult = string.Empty;
IntPtr bstr = Marshal.SecureStringToBSTR(secureString);
try
{
stringResult =Marshal.PtrToStringBSTR(bstr);
}
finally
{
Marshal.FreeBSTR(bstr);
}
return stringResult;
System.Web.HttpUtility.UrlEncode("你的uri")
需要添加System.Web.dll引用