Email subject in localization received wrongly


I have a problem to dispay the email subject with localization characters in GAE/GWT deployment evironment ( e.g. Frech. Please see the code below:

	Properties props = new Properties(); 
	Session mailSession = Session.getDefaultInstance(props, null);
	MimeMessage message = new MimeMessage(mailSession);
	message.setFrom(new InternetAddress(CFG_MAILFROM));

	title = MimeUtility.encodeText(title);

	message.addRecipient(Message.RecipientType.TO, new InternetAddress(address));


If I send the subject “titre en français”, I will receive “titre en fran?ais”. It looks like the famous encoding issue, but the code (more config should be added) works fine in Eclipse Tomcat development evironment.

So, it is really puzzled me. If you have any idea, please let me know.

Thanks in advance.

I would try setting explicitly the encoding to UTF-8, using the second parameter in the encodeText() call.
Your other alternative is to strip the accents in the Subject header – many systems don’t process them correctly anyway, no matter what the standards say.

In order to strip accents, the easiest way is to do (for older Java, the Normalizer API is slightly different, Google it up)

java.text.Normalizer.normalize(s, java.text.Normalizer.Form.NFD);

Thank you, Jean! The first solution works.