Chandan
Chandan

Reputation: 11

Translation of Unicode characters in mail header

I am currently working on a module which send mails to customers in multiple languages from a server.

Problem: The subject shows the unicode as it is in my DB. Translation does not take place.

I am aware that some mail header configuration has to be done, but not sure what and how. Also RFC 2047 seems to provide a solution, but how do I use this particular RFC?

Thanks in advance. -Chandan

Upvotes: 0

Views: 873

Answers (2)

AlexR
AlexR

Reputation: 115338

As @deceze said you do not "really" work with unicode. You are using the HTML notation to mark unicode characters. The body of your email is formatted as HTML, so email client interprets them just as browser does.

The email subject is not a part of HTML formatted body, so it is not shown correctly.

You should either switch to really working with unicode, i.e. define DB encoding as UTF-8 and store there unicode texts, so that you will not see texts like ضنتةى but will see ضنتةى instead.

In this case everything will work. If you cannot do this for any reason you have to perform the "translation" in your java code.

BTW additionally to this translation you should specify the document direction rtl - right to left. Otherwise the text will be adjusted to the left on systems with default left-to-right document direction.

Upvotes: 3

Related Questions