How can I encode a filename according to RFC 2231?

2019-07-05 02:43发布

I need to encode file attachments at the Content-Disposition HTTP header attribute. I noticed that RFC 2231 is the latest widely-accepted standard and would like to use that. However, I have trouble finding an implementation of that within the core Java SE and Java EE libraries. Do you guys have any recommendations?

A brief search on Google yielded this but I ain't sure how trustworthy it is. I was hopping javax.mail.internet.MimeUtility supports RFC 2231 encoding method but it does not appear to (although it did mention RFC 2231 in decoding).

Any input would be welcomed. I am sure this is a common problem for Java web development.

Thanks.

标签: java rfc2231
1条回答
老娘就宠你
2楼-- · 2019-07-05 03:27

RFC 2231 is related to MIME (sending emails). Regarding HTTP you shoud read RFC 5987 or 6266.

查看更多
登录 后发表回答