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

32,188

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.

You should be sending:

Content-Type: application/pdf
Share:
32,188
Kevin G.
Author by

Kevin G.

Updated on January 06, 2020

Comments

  • Kevin G.
    Kevin G. over 4 years

    I'm looking to see whether this is correct as an HTTP response header

      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. 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. Data in character sets other than "ISO-8859-1" or
    its subsets MUST be labeled with an appropriate charset value.
    rfc2068 HTTP/1.1

    And that rfc3778 The application/pdf Media Type doesn't mention charsets at all.

    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?

    Can anyone confirm or deny or point me to a better RFC?

  • Álvaro González
    Álvaro González over 5 years
    I haven't read RFC 3778 The application/pdf Media Type but Find in page yields zero results for charset.