Accented characters are not displayed

I have a requirement when an email is sent to the user, and he can respond directly to the email and that the content of the email is published in his account.

The problem with accented characters is not displayed properly when a user sends content from their email. I am sending an email using the MailMessage class:

 message.BodyEncoding = Encoding.UTF8; message.SubjectEncoding = Encoding.UTF8; 

As you can see, both the body and the subject are encoded by UTF8. But when I send a message from my letter, the emphasis is converted to ?. Can someone tell me what I am missing?

Edit: Does this have anything to IsBodyHtml with IsBodyHtml ? I have not set IsBodyHtml to true. It's necessary?

+4
source share
1 answer

I see that despite using UTF8 for encoding, the default media type used for the body is text / plain - it is ASCII (i.e. an ASCII character set). If you use IsBodyHtml , it will use the text type text / html, which will use the ISO-8859-1 character set.

+2
source

Source: https://habr.com/ru/post/1433617/


All Articles