Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mail with French / Spanish accented characters appear as Question marks

843834Nov 4 2007 — edited Nov 13 2007
Hi

I am facing issues in mails that have French / Spanish accented characters in mail subject.Accented characters appear as Question marks (?) when received in the inbox.Mail subject is read from properties file.

Please let me know the following

- Should I have the entries in properties file in Unicode ? For example French accent character � is represented as á

- Should I replace msg.setSubject(subject); to msg.setSubject(subject,"UTF-8");


Please suggest.

Below is code snippet :

Session session = getSession();
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(from);
InternetAddress[] addressTo = new InternetAddress[recipients.length];
for (int i = 0; i < recipients.length; i++)
{
addressTo[i] = new InternetAddress(recipients);
}
msg.setFrom(addressFrom);
msg.setRecipients(Message.RecipientType.TO, addressTo);
msg.setSentDate(new Date());
* msg.setSubject(subject);*
MimeMultipart mp = new MimeMultipart("related");
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2007
Added on Nov 4 2007
22 comments
3,047 views