- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有很多来自不同来源的电子邮件。他们都有附件,其中很多都有中文附件名称,所以这些名称由他们的电子邮件客户端转换为 base64。
当我收到这些电子邮件时,我希望对名称进行解码。但还有其他名字不是 base64。 jython编程语言如何区分字符串是否为base64?
即。
第一个附件:
------=_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
最佳答案
header 值告诉您:
=?gb2312?B?uLGxvmhlbrixsb5nLnhscw==?="=?" introduces an encoded value"gb2312" denotes the character encoding of the original value"B" denotes that B-encoding (equal to Base64) was used (the alternative is "Q", which refers to something close to quoted-printable)"?" functions as a separator"uLG..." is the actual value, encoded using the encoding specified before"?=" ends the encoded value
所以 split “?”实际上让你得到这个(JSON 符号)
["=", "gb2312", "B", "uLGxvmhlbrixsb5nLnhscw==", "="]
在结果数组中,如果“B”在位置 2,你面对的是位置 3 的 base-64 编码字符串。解码后,一定要注意位置 1 的编码,可能是最好使用该信息将整个内容转换为 UTF-8。
关于python - 如何判断一个字符串是不是base64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/271657/
此处,“OK”当然意味着 AYOR(风险由您自己承担),但如果避免与现有属性名称发生明显冲突,则不会出现可预见的问题。 Skyfield物体——尤其是行星——通常具有有限数量的属性。我经常编写简短的脚
我们有一个(假设)将在 1-2 年内完成的项目。到那时,JDK7(希望还有 Java7 JCP 规范)应该准备就绪。 但是,我想知道,甲骨文做出“愚蠢”决定的“危险”有多大,这会使 JDK7 成为一个
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 6 年前。 Improv
要知道,haswell是英特尔作为Ivy Bridge微架构的“第四代核心”继承者而开发的一种处理器微架构的代号。 1英特尔正式发布了基于这种微架构的CPU... More 但是,我想知道如何通过在
修改 setter 参数是否正常?假设我们有 setString 方法。我们真的想保留字符串的修剪形式。所以带有尾随空格的字符串是无效的,但我们不想抛出异常。 最好的解决办法是什么?修剪 setter
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 去年关闭。 Improve this
我写了一段代码,然后编译它没有错误。但是当我运行时,它会引发异常(java.lang.NoClassDefFoundError: TesKt$test$1$1)。 这是语言错误吗? private f
这道题是从算法导论的习题23.1-7演化而来的。 原问题是: 23.1-7争论如果一个图的所有边权重都是正的,那么连接所有顶点并且具有最小总权重的边的任何子集必须是一棵树。举例说明,如果我们允许某些权
假设我创建了一个 lambda 实例,稍后我想查询该对象以查看它是 proc 还是 lambda。如何做到这一点? .class() 方法不起作用。 irb(main):001:0> k = lamb
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
所以我正在将我的一个程序移植到一个新的游戏机上。问题是用于编译我的 c++ 应用程序的 SDK 不支持 __int16,但它支持 int16_t。使用 int16_t 代替 __int16 是否“安全
我最近偷看了 Url.IsLocalUrl() 方法的实现,该方法被广泛使用并被推荐为用于防止重定向攻击的措施之一。我惊讶地发现,如果我要为我的应用程序中的 Controller 的其中一个操作提供完
我读了这篇好文章 Angular onPush Change Detection Strategy 在某个时候他写道: It’s an anti-pattern to expose your subj
我是这样理解的: Innodb 中的缓冲池:它存储来自 Sql 表的索引和数据并缓存它以供将来查询,因此它不需要一直打扰 Mysql。 Memcached:用于存储从 Innodb 接收到的数据并对其
以防万一 vector 为空,(意外,异常(exception)情况) cppreference 在 vector::back() 上说: Calling back on an empty conta
我是一名优秀的程序员,十分优秀!