encoding > java, javamail and mysql
Hi All,
I made a program read content from database and send it over the net through email (which i use javamail).
The problem is that if the content has international character, then its content in the mailbox, like google, (after i received) is not correctly decoded.
MySQL setting is:
character set connection: utf8
character set server: utf8,
character set results: utf8
I also added to the java application:
System.setProperty("file.encoding", "utf8");
If i use a php program to see the content in my database, it is correctly displayed all international characters.
For the javamail, i am quite sure i have encoded with utf8, example:
msg.setSubject(to.subject, "UTF-8");
msg.setDataHandler( new DataHandler(bodyContent, "text/html; charset=\"UTF-8\""));
If i put the content as a constant storing international chars in the code, then i received email in my mail box correctly decoded.
Do you see any reasons why the content in my mail box is not correctly displayed if i read it from database and send over through javamail?
Thank you for your kind help,
-Hoang Long