Decoding UTF-8 email subject?

后端 未结 3 751
深忆病人
深忆病人 2021-01-04 11:40

I have a string in this form: =?utf-8?B?zr...

And I want to get the name of the file in proper UTF-8 encoding. Is there a library method somewhere in ma

3条回答
  •  梦谈多话
    2021-01-04 11:57

    In MIME terminology, those encoded chunks are called encoded-words. Check out javax.mail.internet.MimeUtility.decodeText in JavaMail. The decodeText method will decode all the encoded-words in a string.

    You can grab it from maven with

     javax.mail
     mail
     1.4.4
    

提交回复
热议问题