idhttp post乱码

场景:xe2 idhttp post乱码的有关问题

xe2 idhttp post乱码的问题
以前用d7、indy9写的程序:用两个函数实现客户端读取服务器端的asp程序生成的xml,一直没什么问题,现在用xe2,用了utf8toansi,utf8decode都会出现乱码,用浏览器却可以正常显示,不知道怎么解决了
Delphi(Pascal) code

function GetdataAsp(AspName:string; StrSql:String):WideString;
begin
  try
    ConnectUrl := 'Http://'+ConnectIni+AspName;
    ReSult := postXml(StrSql,ConnectUrl);
  except
    on Ex:exception do
    begin
      ShowMessage(Ex.Message);
      assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt');
      Append(ErrorF);
      try
        writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message);
      finally
        closefile(ErrorF);
      end;
    end;
  end;
end;

function postXml(const xmlstr, url: WideString): WideString;
var
  idHttp:TIdHTTP;
  sends:tstrings;
  IdEncoderMIME1:TIdEncoderMIME;
  vStream: TMemoryStream;
begin
  result:='';
  try
    idHttp:= TIdHTTP.Create(nil);
    idHttp.Request.ContentType := 'application/x-www-form-urlencoded';
    idhttp.Request.AcceptCharSet := 'UTF-8';
    idhttp.Request.AcceptEncoding := 'UTF-8';
    idhttp.Request.AcceptLanguage := 'UTF-8';
    sends:=tstringlist.Create;
    sends.Add('strSQL='+(xmlstr));
    result:=idhttp.Post(url,sends);
  except
    on Ex:exception do
    begin
      assignfile(ErrorF,ExtractFilePath(Application.exename)+'ErrorMessage.txt');
      Append(ErrorF);
      try
        writeln(ErrorF,DateTimeToStr(now)+' | '+Ex.Message);
      finally
        closefile(ErrorF);
      end;
    end;
  end;
  idHttp.Free;
  sends.Free;


------解决方案--------------------
D2009以前的string是AnsiString,D2009及以后则是UnicodeString,这里注意一下。
------解决方案--------------------
我来顶顶帖子的
努力学习中