我是这么转的
public static string gb2312_utf8(string text) { //声明字符集 System.Text.Encoding utf8, gb2312; //gb2312 gb2312 = System.Text.Encoding.GetEncoding("gb2312"); //utf8 utf8 = System.Text.Encoding.GetEncoding("utf-8"); byte[] gb; gb = gb2312.GetBytes(text); gb = System.Text.Encoding.Convert(gb2312, utf8, gb); //返回转换后的字符 return utf8.GetString(gb); }
然后将转好的字符串付给attach这个参数,支付完后取出来保存
HttpUtility.UrlEncode("中国", Encoding.UTF8);