鍘讳綘鐨
怎么把中文件转换过来? 成 ”鍘讳綘鐨“这样的东西
在idhttp  post 的时候要post 这样的 文字才会成功 post  中文不行 要怎么把中文换成这些乱码的

解决方案 »

  1.   

    function AnsiToUtf8(const S: string): UTF8String;function Utf8ToAnsi(const S: UTF8String): string;
      

  2.   

    方案二:
    function UrlEncode(const DecodedStr:string;Pluses:Boolean):string;
    var
      I:Integer;
    begin
      Result:='';
      if Length(DecodedStr)>0 then
        for I:=1 to Length(DecodedStr) do
        begin
          if not(DecodedStr[I]in ['0'..'9','a'..'z',
            'A'..'Z',' ']) then
            Result:=Result+'%'+IntToHex(Ord(DecodedStr[I]),2)
          else if not(DecodedStr[I]=' ') then
            Result:=Result+DecodedStr[I]
          else
          begin
            if not Pluses then
              Result:=Result+'%20'
            else
              Result:=Result+'+';
          end;
        end;
    end;function UrlDecode(const EncodedStr:string):string;
    var
      I:Integer;
    begin
      Result:='';
      if Length(EncodedStr)>0 then
      begin
        I:=1;
        while I<=Length(EncodedStr) do
        begin
          if EncodedStr[I]='%' then
          begin
            Result:=Result+Chr(HexToInt(EncodedStr[I+1]
              +EncodedStr[I+2]));
            I:=Succ(Succ(I));
          end
          else if EncodedStr[I]='+' then
            Result:=Result+' '
          else
            Result:=Result+EncodedStr[I];
          I:=Succ(I);
        end;
      end;
    end;