简体   繁体   English

application / pdf content-type http响应头的正确charset是什么?

[英]what is the correct charset for a application/pdf content-type http response header?

I'm looking to see whether this is correct as an HTTP response header 我想看看这是否正确作为HTTP响应标头

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

or we should be emitting this instead 或者我们应该发出这个

  Content-Type: application/pdf

I believe the latter is correct, given this: 我认为后者是正确的,鉴于此:

The "charset" parameter is used with some media types to define the character set (section 3.4) of the data. “charset”参数与某些媒体类型一起用于定义数据的字符集(第3.4节)。 When no explicit charset 什么时候没有明确的字符集
parameter is provided by the sender, media subtypes of the "text" 参数由发件人,“文本”的媒体子类型提供
type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. type通过HTTP接收时定义为具有默认字符集值“ISO-8859-1”。 Data in character sets other than "ISO-8859-1" or 除“ISO-8859-1”之外的字符集中的数据
its subsets MUST be labeled with an appropriate charset value. 它的子集必须用适当的字符集值标记。
rfc2068 HTTP/1.1 rfc2068 HTTP / 1.1

And that rfc3778 The application/pdf Media Type doesn't mention charsets at all. rfc3778应用程序/ pdf媒体类型根本没有提到字符集。

This SO discussion is where I started, but isn't specifically about application/pdf: Is it categorically wrong to send a charset parameter with a Content-Type header for non-text media types? 这个SO讨论是我开始的地方,但不是专门针对application / pdf: 对于非文本媒体类型,发送带有Content-Type标头的charset参数是绝对错误的吗?

Can anyone confirm or deny or point me to a better RFC? 任何人都可以确认或否认或指向更好的RFC吗?

There is no charset value applicable. 没有适用的字符集值。 PDF is a binary format which handles character encodings internally, in a way that's not relevant to MIME types at all. PDF是一种二进制格式,它在内部处理字符编码,其方式与MIME类型完全无关。

You should be sending: 你应该发送:

Content-Type: application/pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java应用程序服务器如何决定在HTTP Content-type标头中发送什么字符集? - How does a Java application server decide what charset to send in the HTTP Content-type header? Content-Type HTTP标头中“charset”的范围 - Scope of “charset” in Content-Type HTTP header HTTP Content-Type响应中的错误字符集 - Wrong charset in HTTP Content-Type response 在golang HTTP FileServer的Content-Type标头上设置'charset'属性 - Setting the 'charset' property on the Content-Type header in the golang HTTP FileServer 字符集组件在HTTP内容类型标头中是否是必需的? - Is the charset component mandatory in the HTTP content-type header? 对具有内容类型的HTTP GET的正确响应 - Correct response for HTTP GET with a Content-Type JSONP 响应 http 内容类型 header - JSONP response http content-type header 将响应标头“ Content-Type”设置为“ application / json”时,HTTP响应正文可以为空吗? - Can HTTP response body be empty when response header 'Content-Type' is set to 'application/json'? 当内容类型标题是image / jpeg时,HTTP响应的内容数据格式是什么? - What is content data format of HTTP response when content-type header is image/jpeg? Json RPC v2 over HTTP 的正确内容类型标头是什么? - What is the correct content-type header for Json RPC v2 over HTTP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM