![]() |
Setting ContentType for bidi language - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Indy (https://www.atozed.com/forums/forum-8.html) +--- Forum: Indy General Discussion (https://www.atozed.com/forums/forum-9.html) +--- Thread: Setting ContentType for bidi language (/thread-949.html) |
Setting ContentType for bidi language - sorinh - 02-20-2019 Hello I try to send an email using IdSMTP and IdMessage components with Hebrew on body text. I use those settings: Code: IdMessage := 'UTF_8'; When I add attachments the emails arrive ok, Without attachments the body text is replaced with questions marks. What I'm doing wrong? RE: Setting ContentType for bidi language - rlebeau - 02-20-2019 (02-20-2019, 11:20 AM)sorinh Wrote: That is not a valid code statement and should not even compile. I assume you meant this instead: Code: IdMessage.CharSet := 'UTF_8'; Note that 'UTF_8' is not a valid charset name, you need to use 'UTF-8' instead (hyphen instead of underscore). Setting the ContentType property to a 'text/...' media type without including a charset attribute will set the CharSet property to 'us-ascii', which is why you end up getting question marks for non-ASCII characters. So, you need to set the CharSet property after setting the ContentType property: Code: if HaveAttachments then Or, include the charset as part of the ContentType property value: Code: if HaveAttachments then That being said, you might consider using TIdMessageBuilderPlain instead and let it handle the details of populating the TIdMessage for you: Code: uses |