Thanks for the answer.
That you quoted works 99% of cases, but I have some emails I receive and the subject line is as follows: ç is replaced by? ã is replaced by?
How can I fix this case, please? Thank you, Carlos Bertolino
Please send the file to us: https://www.limilabs.com/blog/i-have-problems-parsing-the-message
The file may be simply incorrect.
As I said before: there is no such thing as subject's charset.
Subject may contain many encoded words, each using a different charset. Subject (or any email header) may not contain non-ASCII characters, unless those are UTF8 and client-server communication explicitly allows that (this is very unlikely, since this standard hasn't been widely adopted yet).