Mail with French / Spanish accented characters appear as Question marks
843834Nov 4 2007 — edited Nov 13 2007Hi
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");