I am building a system for reading emails in C #. I have a problem with the analysis of the topic, a problem that, it seems to me, is related to the encoding.
The subject that I am reading is as follows: =?ISO-8859-1?Q?=E6=F8sd=E5f=F8sdf_sdfsdf?= , The source object sent is æøsdåføsdf sdfsdf (there are Norwegian characters there).
Any ideas how I can change the encoding or parse it correctly? So far, I have been trying to use C # code conversion methods to encode an object in utf8, but with no luck.
Here is one of the solutions I tried:
Encoding iso = Encoding.GetEncoding("iso-8859-1"); Encoding utf = Encoding.UTF8; string decodedSubject = utf.GetString(Encoding.Convert(utf, iso, iso.GetBytes(m.Subject.Split('?')[3])));
source share