How can I encode a filename according to RFC 2231?

元气小坏坏 提交于 2019-12-10 21:33:02

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/16782005/how-can-i-encode-a-filename-according-to-rfc-2231

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!