Baidu 默认的是gb2312 ,google 默认utf-8
//oStr 是UrlEncode编码字符串
Encoding gb2312 =Encoding.GetEncoding(“gb2312”);
Encoding utf-8=Encoding.UTF8;
//首先进行utf-8 进行 解码
String key =HttpUtility.UrlDecode(oStr,utf8);
//将解码的字符再次进行解码
String encode=HttpUtility.UrlEncode(key,utf8).ToLower();
//与原来编码进行对比,如果不一致,说明编码不正确,用gb2312进行解码
If(oStr!=encode)
{
Key=HttpUtility.UrlDecode(oStr,gb2312);
}