Re: Confused with encodings

Giganews Newsgroups
Subject: Re: Confused with encodings
Posted by:  Remy Lebeau (Indy Team) (
Date: Mon, 14 May 2007

"Dmitry_Malutin" <xaraxt…> wrote in message

> I set charset property of idSMTP component to windows-1251
> and send the message.

There is no Charset property on TIdSMTP, so I assume you are referring
to the TIdMessage.Charset property instead.  In any case, the Charset
property has no effect on the actual message data.  All it does is
sets the "charset" attribute of the "Content-Type" header, nothing
else.  It is your responsibility to encode your data accordingly
before you put it into the TIdMessage.

> Then I get that e-mail with properly encoded body and WRONG
> encoded subject. Subject is KOI-8, body is Windows-1251.

Message headers are encoded separately and automatically by Indy, by
default using the actual charset of the OS that the message is being
generated on.  To override that, you need to use the
TIdMessage.OnInitializeISO event.

The message body, on the other hand, does not use the OS charset at
all, and is not encoded with a charset automatically.



In response to

Confused with encodings posted by Dmitry_Malutin on Sat, 12 May 2007