c*y 发帖数: 137 | 1 I am writing an email client. There are several lines like this in the program:
message.getContent()
Then for one email I got an exception which will abort the operation, the exception
is:
java.io.UnsupportedEncodingException: X-UNKNOWN
I looked at the email mesage, and found out in the headers of the email:
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN
obviously it was the charset's problem..
How can solve this problem?
Thanks. | g****y 发帖数: 141 | 2 what is in that email?
guess u must have ur program support X-UNKNOWN...
program:
exception
【在 c*y 的大作中提到】 : I am writing an email client. There are several lines like this in the program: : message.getContent() : Then for one email I got an exception which will abort the operation, the exception : is: : java.io.UnsupportedEncodingException: X-UNKNOWN : I looked at the email mesage, and found out in the headers of the email: : Content-Type: TEXT/PLAIN; charset=X-UNKNOWN : obviously it was the charset's problem.. : How can solve this problem? : Thanks.
| c*y 发帖数: 137 | 3 The emails header has an entry says:
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN
I don't think X-UNKNOWN is a valid charset... hehe. anyway, what I did is
before call getContent(), I call getContentType(), if it's sth weird, then I
just use writeTo() to write the raw data into a file without decoding it...
hehe.
【在 g****y 的大作中提到】 : what is in that email? : guess u must have ur program support X-UNKNOWN... : : program: : exception
| r*****s 发帖数: 985 | 4 Suppose you are using Java Mail API. For messages with attachment,
you cannot use msg.getContent() directly. Instead, you need to get its
Part object first. Then getContent() from it. The content could be
text string, or Multipart. If the latter, you will have to do it
recursively ...
【在 c*y 的大作中提到】 : I am writing an email client. There are several lines like this in the program: : message.getContent() : Then for one email I got an exception which will abort the operation, the exception : is: : java.io.UnsupportedEncodingException: X-UNKNOWN : I looked at the email mesage, and found out in the headers of the email: : Content-Type: TEXT/PLAIN; charset=X-UNKNOWN : obviously it was the charset's problem.. : How can solve this problem? : Thanks.
| c*y 发帖数: 137 | 5 As far as I know, for a msg with attachment, its bodypart is an multipart,
so your first use getContent() to get the multipart, then process the
parts in the multipart.
This problem was not due to multipart, but because some application put
X-UNKNOWN in "content-type" field, which java parse can't deal with..
【在 r*****s 的大作中提到】 : Suppose you are using Java Mail API. For messages with attachment, : you cannot use msg.getContent() directly. Instead, you need to get its : Part object first. Then getContent() from it. The content could be : text string, or Multipart. If the latter, you will have to do it : recursively ...
| e***g 发帖数: 158 | 6
nobody can... the client has to guess, or let user to select.
【在 c*y 的大作中提到】 : As far as I know, for a msg with attachment, its bodypart is an multipart, : so your first use getContent() to get the multipart, then process the : parts in the multipart. : This problem was not due to multipart, but because some application put : X-UNKNOWN in "content-type" field, which java parse can't deal with..
|
|