This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading utf-8 data from email attachments  RSS feed

 
Peter Straw
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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)?

Many thanks..
 
Paul Clapham
Sheriff
Posts: 22472
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!