This project is read-only.

Encoding error when receiving a iso-8859-1 plain text mail


when receiving a plain text email in iso-8859-1 encoding the text gets messed up and special chars like "ä" "ö" "ß" etc. are displayed as "?"
i looked at the parser and edited the
public static Message ParseMessage(byte[] data)
method. the text is downloaded and then with iso-8859-1 encoding converted to byte[] in the parser method its converted back to text again, but with utf-8 charset.
if you change it to iso-8859-1 it will display the text correct, but i dont have a clue if this "fix" is affecting other scenarios.
in my test with plain and html mails via pop3 and embedded screenshots the issue seems to be fixed.
would be great if you would have a look at it.
thanks :)


thoqbk wrote Aug 1, 2013 at 11:04 AM

Could you share your code with us? Even though it's just experimental?

stylefish wrote Aug 2, 2013 at 12:45 PM

hey thoqbk,
you just have to change one line of code in the MailSystem Library.
just find in the Parser.cs file the line with the method definition:
public static Message ParseMessage(byte[] data)
and then the line:
string msg = System.Text.Encoding.UTF8.GetString(data, 0, data.Length);
and change it to:
string msg = System.Text.Encoding.GetEncoding("iso-8859-1").GetString(data, 0, data.Length);
that should be all. hope that helps :)

wrote Feb 13, 2014 at 9:47 AM