|Subject:||Re: Problem with French and Spanish Characters with TIdMessage|
|Posted by:||Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)|
|Date:||Mon, 6 Jun 2011|
"Louis Valmeras" <valmlou…@hotmail.com> wrote in message
> When the message is in english there is not problem. But with messages
> with French
> or Spanish characters, the message is delivered like below:
That is because you are not specifying any charset for the text, so Indy
ends up using ASCII as a default. You need to set the TIdMessage.CharSet
and/or TIdText.CharSet property. Since you are using XE, I suggest using
"utf-8" as the charset (which matches the charset of the HTML you are trying
to send), eg:
TexteHTML = new TIdText(AlertEmail->MessageParts, TexteMessage->Lines);
TexteHTML->ContentType = "text/html";
TexteHTML->CharSet = "utf-8"; // <-- here
> I though that it was related to the charset utf-8 in the html code.
It is. But that is only half of it.
> But even if I replace it with ISO-8859-1, the result is the same. What can
> be the problem?
You are not setting the CharSet for the email text.
Remy Lebeau (Indy Team)
Problem with French and Spanish Characters with TIdMessage posted by Louis Valmeras on Mon, 6 Jun 2011