Accented characters not showing up

蹲街弑〆低调 提交于 2019-12-22 09:34:13

问题


I have a requirement where an email is sent to an user and he can directly reply to the email and that email's content gets posted in his account.

Problem is accented characters are not showing up properly when user posts the content from his email. I send email using MailMessage class:

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

As you can see both the body and subject are UTF8 encoded. But when I post the message from my email, the accent gets converted to ?. Can anybody tell me what am I missing?

Edit: Does this have anything to do with IsBodyHtml? I haven't set IsBodyHtml to true. Is that required?


回答1:


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



来源:https://stackoverflow.com/questions/12374211/accented-characters-not-showing-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!