I have an email handler that does the following:
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session, req.getInputStream());
String content = getContent(message);
where getContent is:
private String getContent(MimeMessage message) throws MessagingException,
IOException {
Object content = message.getContent();
if (content instanceof String)
return (String)content;
if (content instanceof Multipart)
return getContent((Multipart)content);
return "";
}
private String getContent(Multipart multi) throws MessagingException,
IOException {
// Get plain text of message
for (int i = 0; i < multi.getCount(); i++) {
if
(multi.getBodyPart(i).getContentType().toUpperCase().startsWith(LedUtils.TEXT_PLAIN_CONTENT_TYPE.toUpperCase()))
{
return (String)multi.getBodyPart(i).getContent();
} // if
} // for
return "";
}
My problem is this:
When someone sends my handler an email with Hebrew characters in it, the
content I receive is partly jibrished.
However, if the message contains only one or two words in Hebrew, it usually
returns a valid content (i.e., all characters are ok).
Any ideas?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.