I'm writing a Java project sending email with attachment.
In my test case, I add some Japanese words "some Hiraganas and Katakanas" to my attached testfile.txt (which I saved in UTF-8 encoding.)
But when I send my test email to myself, after I opened the attached testfile.txt, every Japanese Chars turns to be "????".
So I'm just wondering why this happens...?
Thank you
Allan
P.S. to be more specific, here is my code. I am using mail.jar to send email.
Here is how I get the file:
/**
* Add an attachment to the Email.
* @param filePath
*/
public void setFile(String filePath){
attachment = new File(filePath);
}
and below is how I attach the file into my MIME email part.
/*Add attachment if an attachment is given.*/
if(attachment != null){
MimeBodyPart attachmentPart = new MimeBodyPart();
attachmentPart.attachFile(attachment);
multipart.addBodyPart(attachmentPart);
}