Search code examples
c#imapcharspolish

Polish characters receive messages imap


I have problem with Polish characters (ś,ć,ż,ź,ń,ó) When I receive body of mail i get "??" for everyone Polish char.

   MailMessage temp_message = receive.get_message(mail);
   temp_message.BodyEncoding = System.Text.Encoding.GetEncoding(28592);

this is result :

UTF 8 , 16 not work too


Solution

  • That isn't strange since you can't convert a string from one encoding to another. What you are doing doesn't make any sense at all.

    The MailMessage class supports setting the encoding, which is a much better option that converting around. Just set the BodyEncoding to whatever you need, preferably UTF-8 or UTF-16 since that is the best option for international characters.