111,094
社区成员




url: 'Ashx/GetProcess.ashx?str=' +encodeURI(“你的字符串”,"UTF-8"),
ashx接收值时:
var str = context.Request["str"];
str = GB2312ToUTF8(str);
public string GB2312ToUTF8(string str)
{
//先将字符串以gb2312转成byte[]
//再将其以utf8编码转为byte[]
//再转为string,并返回
Encoding utf8 = Encoding.GetEncoding("UTF-8");
Encoding gb2312 = Encoding.GetEncoding("GB2312");
byte[] gb = gb2312.GetBytes(str);
gb = Encoding.Convert(gb2312, utf8, gb);
string temp = utf8.GetString(gb);
return temp;
}