Bug in IdMessageClient (Indy 10.0.52)

Giganews Newsgroups
Subject: Bug in IdMessageClient (Indy 10.0.52)
Posted by:  Holger Dors (do…@kittelberger.de)
Date: Wed, 22 Dec 2004

Hello,

there's a small bug in IdMessageClient.pas when sending an TidText message
part in QuotedPrintable encoding and a line starts with a "."; instead of

=2EMessagetext

or

.Messagetext

you get

=2E.Messagetext

which is one character to much. (Why . is encoded at all remains a mystery
to me...)

Here's my proposed change: in the local procedure WriteTextPart of
procedure TIdMessageClient.SendBody change the lines starting at line 917:

        LBodyLine := ATextPart.Body[i];
        if (LBodyLine <> '') and (LBodyLine[1] = '.') then begin
{do not localize}
          ATextPart.Body[i] := '.' + LBodyLine;
{do not localize}
        end;
        LData := TIdEncoderQuotedPrintable.EncodeString(ATextPart.Body[i]
+ EOL);

to

        LBodyLine := ATextPart.Body[i];
        LData := TIdEncoderQuotedPrintable.EncodeString(ATextPart.Body[i]
+ EOL);
        if (LData <> '') and (LData[1] = '.') then begin          {do not
localize}
          LData := '.' + LData;                            {do not
localize}
        end;

In other words: encode first, then check if the line starts with a '.'

Oh, I'm using Indy Version 10.0.52.

TIA,
  Holger

Replies