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!

Howto create recipient with umlaut?

843834Jan 27 2010 — edited Jan 29 2010
Hi there,
when I try to send an eMail to a recipient containing an umlaut, the umlaut ends up as Question Mark.
Umlauts in Subject and Body work just fine. I am using jdk 1.6.0.18/linux i386 and javamail 1.4.3:
MimeMessage m = new MimeMessage(s);
m.setFrom( new InternetAddress( "me@localhost" ) );
m.setRecipients( Message.RecipientType.TO, new InternetAddress[] {
	new InternetAddress( "\"Schöne Umlaute\" <you@elsewhere.com>" ) // mail delivers but name is garbled
});
Multipart body = new MimeMultipart();
m.setSubject("Etwas schönes"); // works
MimeBodyPart part = new MimeBodyPart();
part.setText( "Ein schöner Inhalt." ); // works
body.addBodyPart(part);
m.setContent( body );
Turning session debugging on reveals that the recipient name is being sent verbatim, whereas the subject is being encoded,
so suspect the problem inside JavaMail. I tried both de_DE and de_DE.UTF-8 as LC_CTYPE.

What am I doing wrong?
Regards
-- Holger

Edited by: HolgerK on Jan 27, 2010 5:28 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2010
Added on Jan 27 2010
4 comments
759 views