Skip to main content

附录 B. 替代方案 (Alternatives)

Appendix B. Alternatives

🇬🇧 英文原文

There are numerous alternative ways for encoding form data that have been proposed or used in various contexts. For example:

  • application/x-www-form-urlencoded: Simple name-value pairs, widely supported but limited to text
  • JSON-based encoding: Modern and flexible but requires additional processing
  • XML-based encoding: Structured but more verbose
  • Direct binary protocols: Efficient but requires custom implementations

multipart/form-data was chosen as the standard for HTML forms because it:

  • Supports binary file data efficiently
  • Maintains compatibility with email systems
  • Allows multiple files and mixed content types
  • Has widespread implementation support

🇨🇳 中文翻译

在各种上下文中已经提出或使用了许多编码表单数据的替代方法。例如:

  • application/x-www-form-urlencoded: 简单的名称-值对,广泛支持但仅限于文本
  • 基于 JSON 的编码: 现代且灵活,但需要额外处理
  • 基于 XML 的编码: 结构化但更冗长
  • 直接二进制协议: 高效但需要自定义实现

multipart/form-data 被选为 HTML 表单的标准,因为它:

  • 有效支持二进制文件数据
  • 保持与电子邮件系统的兼容性
  • 允许多个文件和混合内容类型
  • 具有广泛的实现支持