Application / * Content-Type and charset attributes

RFC-2616 is stated in 3.7.1:

If the sender does not provide an explicit charset parameter, the environment subtypes of type "text" are defined as having the default encoding value "ISO-8859-1" when received via HTTP.

This is why I usually use, for example, text/plain; charset=utf-8as a title Content-Type.

What about MediaTypes type application?

I often see and use type headers Content-Type: application/xml; charset=UTF-8. RESTeasy 2.3.7 then forces the client to also send the charset parameter to the header Accept. Otherwise, he will respond with 406. RESTeasy 3.0.6 seems more understandable here, so I'm not sure what is best here.

+4
source share
1 answer

RFC 2616 was an obsolete set of RFCs in June 2014, where one that contains general HTTP specifications is RFC 7213 . Please use the RFC editor to check the current status of the RFC.

RFC 7213 explicitly says (in Appendix B):

The default font for ISO-8859-1 for text media has been removed; the default is what is specified in the media type definition.

On the other hand, RFC 6657 , anticipating such changes, announces:

The default charset for text / plain does not change from [RFC2046] and remains US-ASCII.

, ASCII (= US-ASCII), charset.

XML, 4.3.3, :

(, MIME-), , UTF-8 UTF-16 [...]

, XML, HTTP, , HTTP, , . <?xml encoding='UTF-8'?>.

application . application, , .

+6

All Articles