How do I get the charset from javax.mail.Message object?
+1
A:
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.
Henning
2009-11-18 10:46:58
+3
A:
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).
Aaron Digulla
2009-11-18 10:47:23
That`s exactly what I`ve been looking for, thank you.
folone
2009-11-18 10:56:14