"?" 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

[404 byte] By [bhuvans123a] at [2007-11-27 2:05:46]
# 1
Just to add to this, this applies only to Japanese characters. English characters work fine.
bhuvans123a at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 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.

bshannona at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 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

bhuvans123a at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 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.

bshannona at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
I have tried these encodings, but could not get away with the question marks appearing in From field.Message was edited by: bhuvans123
bhuvans123a at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 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.

bshannona at 2007-7-12 1:52:08 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...