Message charset
How do I g开发者_JAVA百科et the charset from javax.mail.Message object?
The mail API should convert the data to Unicode for you, so at the time when you can call the getter for the text, the original charset shouldn't matter.
But if you really need it, then call getContentType()
and look for charset=
. If it's there, then that's the encoding. If it isn't there, then the charset should be US-ASCII
(7 bit).
The MimeMessage
class has a method which returns the transfer encoding.
Edit: But, as Aaron correctly points out, you normally shouldn't have to worry.
精彩评论