简体   繁体   中英

org.apache.commons.mail attachment file name encoding

I'm using apache commons mail for sending e-mails with attachments. My attachment file content is in hebrew and I can see it when I open the file , my problem is when the attachment file name is in hebrew I can't see the name I see ??? instead. (the content I still see ok).

this is my code:

String attachment_file_name = "קובץ מס 1";

HtmlEmail email = new HtmlEmail();
email.setHostName(smtp_server);
email.addTo(to_email;
email.setFrom(from_email , "XXXXXXX");
email.setSubject(subject);
email.setCharset("UTF-8");    
email.setHtmlMsg(body);          
email.attach(new ByteArrayDataSource(attachment_file_.toByteArray(), "application/pdf"), 
                                     attachment_file_name , 
                                     "attachment pdf",     
                                     EmailAttachment.ATTACHMENT);                     

email.send();                     

what do I need to do inorder to see the file name in hebrew (in the correct encoding) ?

Thank's In Advance.

I believe you have to encode it.

Javamail, the core library requires this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM