5

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?

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Jack
  • 7,433
  • 22
  • 63
  • 107
  • Have you tried HTML encoding the text? – John Sobolewski Sep 11 '12 at 17:17
  • No, do you mean I should encode the email when sending? Please note I can see accented text when I sent email from my application. But I can't see accented text when user replies to that email. Do you think encoding the email will help in solving this issue? – Jack Sep 11 '12 at 17:21
  • 1
    well you can't control what encoding they use for the email. If they convert your UTF8 to ASCII then your special e will get dropped for a ? – John Sobolewski Sep 11 '12 at 17:26
  • @jsobo: Let's assume they don't do that. Then what do you think is the issue with accent? – Jack Sep 11 '12 at 17:29
  • 1
    Post an accent you are having trouble with – paparazzo Sep 11 '12 at 17:30
  • @Jack: if jsobo's hypothesis is correct, but we're assuming that it's not, we'll never solve the problem. – phoog Sep 11 '12 at 17:32

1 Answers1

3

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.

Peter Ritchie
  • 35,463
  • 9
  • 80
  • 98