I have unicode for Simplified Chinese. I would like to send an email with Chinese subject and content. The content works fine-which converts unicode to Chinese, however the subject alwasys shows unicode instead of Chinese. Can anybody help? Enclosed you can see a part of my code:

session = Session.getInstance(props, null);
		
		MimeMessage message = new MimeMessage( session );
		
		message.setHeader("Content-Type", "text/plain; charset=UTF-8");


		message.setFrom( new InternetAddress( from ) ); 
		message.addRecipient( Message.RecipientType.TO, new InternetAddress( to ) ); 
		message.setSubject(subject, "text/plain; charset=utf-8"); 
 
		BodyPart messageBodyPart = new MimeBodyPart(); 
		messageBodyPart.setContent( content, "text/html; charset=utf-8" ); 

		Multipart multipart = new MimeMultipart(); 

		multipart.addBodyPart( messageBodyPart ); 

		message.setContent( multipart ); 

		Transport.send( message );

Thanks,
MyDreamGirl

I also tried following code and it does not work:

message.setSubject(MimeUtility.encodeText("亲爱的用户", "UTF-8", "B"));

Please help.

MyDreamGirl

a

nmaillet,

Do you want to say something?

I reviewed bioth links and I tried all possibilities and they do not work.

Any other suggestions?

MyDreamGirl

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.