var IdHTTP1:TIdHTTP; postStream : TStringStream; Wstr:WideString;
res:WideString; begin IdHTTP1 := TidHTTp.create(nil); try Wstr:= 'aaccount=' + aaccount; Wstr:=Wstr+'&'+'passwd=' +passwd; postStream:=TStringStream.Create(ansitoUTF8(Wstr)); IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; try res:=Utf8ToAnsi(IdHTTP1.Post(infoURl,postStream)); except on E:Exception do begin MsgBox('錯誤信息:' +e.message); end; end; vJson := SO(res); end;
用stringlistPOST提交時會亂碼,改用該方法后解決。