【问题标题】:what is the correct charset for a application/pdf content-type http response header?应用程序/pdf 内容类型 http 响应标头的正确字符集是什么?
【发布时间】:2014-06-03 11:49:22
【问题描述】:

我正在查看这是否正确作为 HTTP 响应标头

  Content-Type: application/pdf; charset=ISO-8859-1

或者我们应该发出这个来代替

  Content-Type: application/pdf

鉴于此,我相信后者是正确的:

“charset”参数与某些媒体类型一起使用来定义 数据的字符集(第 3.4 节)。当没有明确的字符集时
参数由发送者提供,媒体子类型为“text”
类型被定义为具有“ISO-8859-1”的默认字符集值 通过 HTTP 接收。字符集中的数据不是“ISO-8859-1”或
它的子集必须标有适当的字符集值。
rfc2068 HTTP/1.1

rfc3778 The application/pdf Media Type 根本没有提到字符集。

这个 SO 讨论是我开始的地方,但不是专门关于应用程序/pdf 的: Is it categorically wrong to send a charset parameter with a Content-Type header for non-text media types?

任何人都可以确认或否认或指出更好的 RFC 吗?

【问题讨论】:

  • 应用程序/pdf 的正确字符集是什么 - 没有! PDF 文件是二进制文件,charset 只能用于文本数据。

标签: http pdf http-headers content-type


【解决方案1】:

没有适用的字符集值。 PDF 是一种在内部处理字符编码的二进制格式,其方式与 MIME 类型完全无关。

你应该发送:

Content-Type: application/pdf

【讨论】:

猜你喜欢
  • 2011-09-30
  • 2013-12-11
  • 1970-01-01
  • 2013-11-17
  • 2011-06-29
  • 1970-01-01
  • 2018-03-06
  • 1970-01-01
  • 2011-08-14
相关资源
最近更新 更多