跳到主要内容
uencoder

MIME Encoding

MIME(多用途互联网邮件扩展)编码定义了在电子邮件中传输非 ASCII 文本与二进制附件的机制,包括 Base64 与 Quoted-Printable 两种内容传输编码。

用途

扩展仅支持 7 位 ASCII 的 SMTP 协议,使其能携带任意字节流与多语言文本。

机制

Content-Transfer-Encoding 头声明编码方式:7bit/8bit/binary 直接传输;base64 编码任意二进制;quoted-printable 仅转义非可打印字符。Content-Type 头声明 MIME 类型与边界。

用例

  • 电子邮件附件传输
  • HTTP multipart/form-data 文件上传
  • Usenet 新闻组二进制附件
  • S/MIME 加密邮件

示例

  • 输入
    Content-Transfer-Encoding: base64
    输出
    SGVsbG8=

    The body is Base64-encoded as declared

常见错误

Decoding a MIME attachment while ignoring the Content-Transfer-Encoding header
Decode according to the header first, then interpret the result using the charset

相关词条

相关工具

参考链接