Issues with UTF-8 email subject

I use Wemos D1 mini as IoT device. The device sends smtp emails from time to time in Hebrew language. While the message text body is formated and shown correctly (RTL, UTF-8), recipient Android phone using Gmail, gets subject text as question marks... How do i fix this?

That's not an Arduino issue, it's just a matter of email subject encoding. You need to specify an UTF-8 encoding for the subject also (the encoding you put inside headers is relative only to the body), with this prefix to be added to the subject string:
=?utf-8?Q?
The "Q" stands for "quoted-printable" encoding, so change your subject to be encoded that way.
Then end the subject with the suffix:
?=
If you change the "Q" with "B" you can encode the subject with base64.

Tnx. I know this not an Arduino issue but I hope to get help in this forum. My email code is based on an example taken from the library. Will write an example how message.subject shout be coded to contains a plsin text message plus the control needed for suppirting Hebrew?

I don't know Hebrew, sorry, but you can get your equivalent quoted printable strings using some internet resource like THIS I got googling "hebrew characters quoted printable converter online".
Once you have converted it, just put it between the prefix and suffix and use it on the subject.

.Sorry. I didn't mean you write the Hebrew syntax. I meant to the syntax of the code content something like message.subject= =?utf-8?Q?+"hebrew text";

Yes, I think I fully described how to do it.
Anyway, if you can type your subject in hebrew, convert it into quoted printable first using one of the available online pages to do that, then paste the encoded result between the prefix and the suffix (don't forget the suffix!).
For instance, if the subject must be "אביב" (sorry for the random hebrew word, it's the first one I found...) you must convert it with the link above obtaining "=D7=90=D7=91=D7=99=D7=91", then add prefix and suffix to get your UTF-8 subject text:

=?utf-8?Q?=D7=90=D7=91=D7=99=D7=91?=

your are a genius!!! thank yu so much :sunflower:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.