Skip to main content

Mail with Unicode Characters (Cyrillic) in Subject

1 reply [Last post]
pstojkovic
Offline
Joined: 2008-05-15

Hello,

how can we send an email with Unicode characters (more specifically, Cyrillic) in the Subject line?
Here is the small piece of code:

Message msg = new Message();
msg.setSubject( "\u041f\u043e\u0437\u0434\u0440\u0430\u0432" );
Desktop.mail(msg);

MS Outlook will pop open but will show question marks in the subject line (???????). When I tried to encode the Unicode string with URLEncoder or with my own base64 encoder, the subject line shows that string just as it is (encoded).
Can anything be done here? The similar question is applicable also for the body and to fields.

Regards

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pstojkovic
Offline
Joined: 2008-05-15

In the meantime, I had to solve my problem one way or another, and the only thing that came up to my mind was to use JavaMail API.
It is not quite what I was hoping for, because it doesn't provide opening of default e-mail client on local machine, but at least it can send e-mail with Unicode characters in the subject line, recipient addresses, etc.

Make a new message using JavaMail and then set it's properties in a fairly simple manner, like this:
[i]message.setSubject( MimeUtility.encodeText("... some Unicode text with Cyrillic symbols ...", "UTF-8", "B") );[/i]

I'd still like to see if there are any suggestions on how to do the similar thing with JDIC.

Regards,
PS