编码不一致 (936到utf-8) 发送xmlhttp 到url后中文乱码

function GetHtml(sUrl,sUrl01){
  var xmlRequest;
  xmlRequest = new ActiveXObject("MSXML2.ServerXMLHTTP");
  xmlRequest.open("POST", sUrl, false);
  xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  xmlRequest.send(sUrl01);
  return xmlRequest.responseText;
 }


 //发送邮件
 function SendMail(Email,Title,Note,CC){
  try{
   var _CodePage = Session.CodePage;  //获取页面原编码
   Session.CodePage = 65001; //设置为65001

   var Code = "W00003";
   var Title = Server.UrlEncode(Title);
   var Note = Server.UrlEncode(Note);
   var url = "123.asp";
   if(!CC)CC="";
   var url01 = ("sender="+Email+"&cc="+CC+"&title="+Title+"&code="+Code+"&note="+Note);
   //WriteLn(Note);
   //WriteLn(url+"?"+url01);
   //Response.End();
   GetHtml(url,url01);
   Session.CodePage = _CodePage; //还原为原编码
  }catch(e){}
 } 
 //发送邮件 end

 
 //发送短信
 function SendSMS(Sender,Note){
  try{
   var _CodePage = Session.CodePage;
   Session.CodePage = 65001;
   var Code = "W00003";
   var Note = Server.UrlEncode(Note);
   var url = "123.asp";
   var url01 = "sender="+Sender+"&code="+Code+"&note="+Note;
   //WriteLn(url01);
   //Response.End();
   GetHtml(url,url01);
   Session.CodePage = _CodePage;
  }catch(e){}
 }
 //发送短信 end

posted @ 2011-06-20 11:23  y0umer  阅读(152)  评论(0编辑  收藏  举报