我有很多来自不同来源的电子邮件。他们都有附件,其中许多都有中文的附件名称,因此这些名称被他们的电子邮件客户端转换为base64。
当我收到这些电子邮件时,我希望解码名称。但还有其他名称不是 base64。如何使用jython编程语言区分字符串是否为 base64?
IE。
第一个附件:
------=_NextPart_000_0091_01C940CC.EF5AC860
Content-Type: application/vnd.ms-excel;
name="Copy of Book1.xls"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Copy of Book1.xls"
第二个附件:
------=_NextPart_000_0091_01C940CC.EF5AC860
Content-Type: application/vnd.ms-excel;
name="=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?="
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?="
请注意“ Content-Transfer-Encoding ”都有 base64