简体   繁体   中英

Decoding 7Bit content-transfer-encoding messages with special characters

I have a case where my code is receiving e-mail messages (pop3, multipart) that has its content-transfer-encoding set to 7Bit. The problem is that the language (from an automatic system) is norwegian. The norwegian language has three special characters (ÆØÅ/æøå). So when I receive the messages, I can get words like this: &N?D?PNER ALARM (ÅPNER ALARM), and kj?kkenomr?de (kjøkkenområde). Is the information about the characters lost, or can they be decoded somehow?

Where are those words appearing? In the headers or the message body?

If you use a library like MailKit , this will automatically be handled properly for you in message bodies and can easily be tuned to handle it even if it is in the headers by specifying a fallback charset to the parser.

If you are using another library, you are probably out of luck (most I've looked at are horrendously bad at this).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM