2 Appendix - Grammar🔗ℹ

From [RFC6838]:

Type and subtype names MUST conform to the following ABNF:

type-name = restricted-name

subtype-name = restricted-name

 

restricted-name = restricted-name-first *126restricted-name-chars

restricted-name-first  = ALPHA / DIGIT

restricted-name-chars  = ALPHA / DIGIT / "!" / "#" /

                         "$" / "&" / "-" / "^" / "_"

restricted-name-chars =/ "." ; Characters before first dot always

                             ; specify a facet name

restricted-name-chars =/ "+" ; Characters after last plus always

                             ; specify a structured syntax suffix

Note that this syntax is somewhat more restrictive than what is allowed by the ABNF in Section 5.1 of [RFC2045] or Section 4.2 of [RFC4288]. Also note that while this syntax allows names of up to 127 characters, implementation limits may make such long names problematic. For this reason, <type-name> and <subtype-name> SHOULD be limited to 64 characters.

Although the name syntax treats "." as equivalent to any other character, characters before any initial "." always specify the registration facet. Note that this means that facet-less standards- tree registrations cannot use periods in the subtype name.

Similarly, the final "+" in a subtype name introduces a structured syntax specifier suffix. Structured syntax suffix requirements are specified in Section 4.2.8.

Also, ...

Parameter names have the syntax as media type names and values:

parameter-name = restricted-name

Parameter names have the syntax as media type names and values:

parameter-name = restricted-name

There is no defined syntax for parameter values. Therefore, registrations MUST specify parameter value syntax. Additionally, some transports impose restrictions on parameter value syntax, so care needs be taken to limit the use of potentially problematic syntaxes; e.g., pure binary valued parameters, while permitted in some protocols, are best avoided.

Note that a protocol can impose further restrictions on parameter value syntax, depending on how it chooses to represent parameters. Both MIME [RFC2045] [RFC2231] and HTTP [RFC2045] [RFC5987] allow binary parameters as well as parameter values expressed in a specific charset, but other protocols may be less flexible.

From [RFC4288]:

Type and subtype names MUST conform to the following ABNF:

type-name = reg-name

subtype-name = reg-name

 

reg-name = 1*127reg-name-chars

reg-name-chars = ALPHA / DIGIT / "!" /

                 "#" / "$" / "&" / "." /

                 "+" / "-" / "^" / "_"

Note that this syntax is somewhat more restrictive than what is allowed by the ABNF in [RFC2045].

From [RFC2045]:

In the Augmented BNF notation of RFC 822, a Content-Type header field value is defined as follows:

content := "Content-Type" ":" type "/" subtype

           *(";" parameter)

           ; Matching of media type and subtype

           ; is ALWAYS case-insensitive.

 

type := discrete-type / composite-type

 

discrete-type := "text" / "image" / "audio" / "video" /

                 "application" / extension-token

 

composite-type := "message" / "multipart" / extension-token

 

extension-token := ietf-token / x-token

 

ietf-token := <An extension token defined by a

               standards-track RFC and registered

               with IANA.>

 

x-token := <The two characters "X-" or "x-" followed, with

            no intervening white space, by any token>

 

subtype := extension-token / iana-token

 

iana-token := <A publicly-defined extension token. Tokens

               of this form must be registered with IANA

               as specified in RFC 2048.>

 

parameter := attribute "=" value

 

attribute := token

             ; Matching of attributes

             ; is ALWAYS case-insensitive.

 

value := token / quoted-string

 

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,

            or tspecials>

 

tspecials :=  "(" / ")" / "<" / ">" / "@" /

              "," / ";" / ":" / "\" / <">

              "/" / "[" / "]" / "?" / "="

              ; Must be in quoted-string,

              ; to use within parameter values