I'm trying to use Java to read a series of attachments from an eml file that has been written to disk. If I open the eml with an email client then the attachments are displayed correctly, but when I try to turn them into Multipart objects in Java and then print these to a console some of the charaters are incorrectly shown as '?' (the majority of the characters are rendered correctly).
The eml file is shown as 'utf-8 unicode' when opened in an email client. Can anybody suggest how I could use java character encoding to display the '?' correctly please (or suggest an alternative)?
The chances are that it's the printing-to-console part that's going wrong, not the reading-from-attachment part. Consoles are notorious for failing to support UTF-8, and you already have a test (your e-mail client) which shows that reading from the attachment can work correctly.
So I would suggest testing with something which supports UTF-8 properly. A small Swing application with a text component would do quite well. If you still have a problem, then it's time to look at your code.
subject: Reading utf-8 data from email attachments