jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Review case of MimeType.Type charsets

Open gregw opened this issue 9 months ago • 2 comments

Jetty version(s) 12

Description

We generate charsets in lower case (e.g. text/html;charset=iso-8859-1), but when parsed by HttpParser, they end up as uppercase: text/html;charset=ISO-8859-1

We should be consistent with our cases

gregw avatar May 03 '24 01:05 gregw

Go with all lowercase. (this should apply to mime-types too)

From https://datatracker.ietf.org/doc/html/rfc9110#section-8.3.1

For example, the following media types are equivalent in describing
HTML text data encoded in the UTF-8 character encoding scheme, but
the first is preferred for consistency (the "charset" parameter value
is defined as being case-insensitive in [RFC2046], Section 4.1.2):

  text/html;charset=utf-8
  Text/HTML;Charset="utf-8"
  text/html; charset="utf-8"
  text/html;charset=UTF-8

joakime avatar Jul 11 '24 12:07 joakime

@joakime I think this is another whatwg inspired cluster-stuffup:

So again, rather than enforce standards, the whatwg again just normalises those that cannot follow simple specifications, and expects the world to follow!

But as you say, RFC9110 recommends we prefer lowercase, so I guess we follow!

gregw avatar Oct 03 '24 00:10 gregw