请教,OutLook 究竟是什么编码? base64? 为什么我用DELPHI,的POP的TidDecodeMIME.DeCodeString(..)解码时,却出错?急!

解决方案 »

  1.   

    可以直接这样用..
    Caption := Base64Decode(IdMessage.From.Text);
    Caption := Base64Decode(IdMessage.Subject.Text);
    以下是自己写的,利用Indy9內建De/EncoderMIME解码..//------------------------------------------------------------------------------
    //Base64Decode
    //------------------------------------------------------------------------------
    function TMainForm.Base64Decode(strInput : string) : string;
    var
    strDecode : string;
    posStart: Integer;
    posEnd : Integer;
    begin
    while pos('=?gb2312?b?',lowercase(strInput)) > 0 do
    begin
    try
    posStart := pos('=?gb2312?b?',lowercase(strInput));
    posEnd := pos('?=',lowercase(strInput));
    strDecode := strDecode + copy(strInput,1,posStart-1) + IdDeMIME.DecodeString(copy(strInput,posStart+11,posEnd-posStart-11));
    strInput := copy(strInput,posEnd+2,length(strInput)-posEnd-1);
    finally
    Application.ProcessMessages;
    end;
    end;
    strDecode := strDecode + strInput;
    result := strDecode;
    end;//------------------------------------------------------------------------------
    //Base64Encode
    //------------------------------------------------------------------------------
    function TMainForm.Base64Encode(strInput : string) : string;
    var
    strEncode : string;
    begin
    strEncode := IdEnMIME.EncodeString(strInput);
    result := strEncode;
    end;//------------------------------------------------------------------------------
    PS.
    IdDeMIME是IdDecoderMIME
    IdEnMIME是IdEncoderMIME
      

  2.   

    MIME-Version: 1.0
    Content-Type: text/plain;
    charset="gb2312"
    Content-Transfer-Encoding: base64
    X-Priority: 3
    X-MSMail-Priority: Normal
    X-Mailer: Microsoft Outlook Express 6.00.3790.0