Bug in TIdEncoderQuotedPrintable

Giganews Newsgroups
Subject: Bug in TIdEncoderQuotedPrintable
Posted by:  Christian Winter (wint…@jam-software.com)
Date: Wed, 13 Apr 2005

Hi all,

i think i found a bug in TIdEncoderQuotedPrintable. While sending mails it
appears that some mails lost some dots. Indy Version is 10. More precisely
it appears if the first char after a NewLine is a dot.

I fixed the private procedure NewLine(const AtPos: integer) of
TIdEncoderQuotedPrintable.Encode to:

    Procedure NewLine(const AtPos: integer);
    begin
      if AtPos = CurrentPos then begin
        WriteToString('=');                          { Do not Localize }
        st.Add(Copy(CurrentLine, 1, CurrentPos-1));
        CurrentPos := 1;
      end else begin
        st.Add(Copy(CurrentLine, 1, AtPos-1)+'=');  { Do not Localize }
        CurrentPos := CurrentPos-AtPos+1;
        if (CurrentLine[AtPos] = '.') then begin    { Do not Localize }
          MoveChars('.', 1, CurrentLine, 1, 1);      { Do not Localize }
          MoveChars(CurrentLine, AtPos, CurrentLine, 2, CurrentPos-1);
          inc(CurrentPos);
        end // if
        else
          MoveChars(CurrentLine, AtPos, CurrentLine, 1, CurrentPos-1);
      end;
    end;

Don't hesitate to contact me again, if you have additional questions.

Regards,

Christian Winter
JAM Software

Replies