Seamus Abshere Seamus Abshere - 1 month ago 8
HTTP Question

What is the difference between Content-Type...charset=X and Content-Encoding=X?

Is there any effective difference between

Content-Encoding: UTF-8
Content-Type: text/html; charset=utf-8


?

Answer

Optional parameter charset makes sense only for text-based content (Content-Types like text/plain, text/html, and such). Not all messages are text.

Content-Encoding means that the whole body has been encoded in some way (usually compressed). Typical values for this header are gzip and deflate. The receipent of this message should decode (e.g. ungzip) the body to get the original message.

I'm not even sure if UTF-8 makes any sense as a value for the Content-Encoding.