其实HttpUtility.UrlEncode是默认的按照.net的utf-8格式进行编码的。
HttpUtility.UrlEncode(url1,System.Text.Encoding.GetEncoding("UTF8")));
或者
String url = GetQueryString("url",Encoding.UTF8).Trim();
public string GetQueryString(String key,Encoding encoding)
{
String stringValue;
NameValueCollection encodingQueryString
= HttpUtility.ParseQueryString(Request.Url.Query,encoding);
return encodingQueryString[key] != null ? encodingQueryString[key].Trim() : "";
}
那哪能叫“乱码”啊,就是那样编码的……