Re: TIdMessage.GenerateHeader Bug

Giganews Newsgroups
Subject: Re: TIdMessage.GenerateHeader Bug
Posted by:  Andrew St. (as@no.spam.yahoo.com)
Date: Tue, 15 Jun 2004

Something like this should work:

.......
  if Encoding = meMIME then begin

TIdMessageEncoderInfo(MessageParts.MessageEncoderInfo).InitializeHeaders(Self);
    if Length(CharSet) > 0 then begin
      if Length(ContentType) = 0 then begin
        ContentType := 'charset="' + CharSet + '"';
      end else begin
        if (Pos ('charset="', LowerCase (ContentType)) = 0) then begin
//<-- as/15.06.2004: Only if not still added
          ContentType := ContentType + ';' + EOL + TAB + 'charset="' +
CharSet + '"';
        end;
      end;

.......

Andrew St. wrote:

> Hi,
>
> TIdMessage.GenerateHeader seems to have a bug: Every time I call
> TidMessage.SaveToStream, a charset-entry is added to the header although
> there is already one --> the Message gets larger and larger.
>
> Example:
>
> ...
> Content-Type: text/plain;
>    charset="ISO-8859-1";
>    charset="ISO-8859-1";
>
>  charset="ISO-8859-1";
>    charset="ISO-8859-1";
>    charset="ISO-8859-1";
>
>  charset="ISO-8859-1";
> ....
>
> Could somebody of the Indy-Core team fix this?
>
> Regards, Andrew St.

Replies

None

In response to

TIdMessage.GenerateHeader Bug posted by Andrew St. on Tue, 15 Jun 2004