请高手指教

解决方案 »

  1.   

    很简单,看看它是用什么格式封装的,一般都用BASE64,你直接把它解码就行了。
      

  2.   

    function TForm1.EncodeChinese(var inputstr:string):string;     //得到的是代码页为CP936的Unicode编码(也可得到的是Unicode编码)
    var
      i,j,len,cur:integer;
      t:string;
      ws:widestring;          //注释掉该项
    begin
      result:='';
      ws:=inputstr;            //注释掉该项
      len:=length(ws);         //改为len:=length(inputstr)
      i:=1;//j:=0;
      while i<=len do
        begin
          cur:=ord(ws[i]);     //改为cur:=ord(inputstr[i])
          fmtstr(t,'%4.4x',[cur]);
          result:=result+t;       //按以上注释的修改后得到的是Uncode编码
          inc(i);
          //j:=(j+1) mod 7;
        end;end;function TForm1.DecodeChinese(var inputstr:string):string;     //将代码页为CP936的Unicode编码转换为GB2312的中文编码
    var
      i,len,j:Integer;
      t:String;
    begin
      Result:='';
      len:=Length(inputstr);
      i:=1;
      while i<=len do begin
        t:=Copy(inputstr,i,4);
        j:=StrToInt('$'+t);
        t:=widechar(j);
        Result:=Result+t;
        i:=i+4;
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);      //得到的英文编码
    var
      i,j,len,cur:Integer;
      t,s,returnstr:String;
    begin
      returnstr:='';
      s:=edit1.Text;
      len:=length(s);
      i:=1;
      j:=0;
      while i<=len do
        begin
           if i<len then
             cur:=(ord(s[i]) shr j) or ((ord(s[i+1]) shl (7-j)) and $ff)
           else
             cur:=(ord(s[i]) shr j) and $7f;
           FmtStr(t,'%2.2x',[cur]);
           returnstr:=returnstr+t;
           inc(i);
           j:=(j+1) mod 7;
           if j=0 then
             inc(i);
        end;
      edit2.Text:=returnstr;