Julian Reschke wrote:
Maybe I'm missing something, but why not leave it alone if the MIME type isn't "text/*" (the only ones where charset is really relevant)?
An excellent example right there of why! For example, it's relevant for some application types: application/xml, application/xhtml+xml, application/x-javascript (yes, I know, not officially registered, still in use).
So yes, the other option is to have a complex setup where some types get it set and some don't with either whitelists or blacklists, or special-case "application/x-www-form-urlencoded" or some such. All of which are less flexible and less future-proof and more complex than the other approach, I think...
-Boris