"?" in From Field of the Java Mail
I am using Java Mail APIs for sending the mails. "From", "To", "CC", "BCC", "Subject" is set in MimeMessage. Earlier I could see "?" in place of both "From" and "Subject".
To fix the Subject issue, I used steps given in "http://support.microsoft.com/kb/324603" and it worked. But still I am getting "?" in From field of the mail. Any idea how this can be fixed? ?
Thanks
Bhuvan
# 2
How are you setting the From field?
If you use InternetAddress and specify the proper charset to use
for the personal name field, it should be properly encoded. Of
course, this assumes you have the correct Unicode characters
in your Java String object to begin with. If you read the name from
somewhere else, make sure the characters are being decoded
properly.
# 3
hi there!
Here is the code which I am using....
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("bhuvans@javaforum.com", m_strFrom, "ISO2022JP")); // m_strFrom is personal name which is in Japanese.
msg.setSubject(m_strSubject, "UTF-8");
msg.setContent(m_multiPart);
msg.setSentDate(new Date());
Transport.send(msg);
Thanks
# 4
Try "iso-2022-jp" and see if that makes a difference.
You can also try "utf-8".
If none of that works, check that you have the right Unicode values for
the characters in m_strFrom.
If that's correct, the problem is almost certainly in the mailer that's
displaying the message.
# 6
Again, there are two obvious possibilities, and you'll have to debug this
to figure out which one it is.
First possibility is that the Unicode characters in your Java String object
are wrong. Try putting m_strFrom in the Subject field and see if that
displays properly in your mail reader.
If it does, then the characters are correct and the problem is that your
mail reader isn't displaying the same characters in the From field
correctly.
If it doesn't, then however you've read those characters to compose
that String is wrong.