On 2012-01-07 15:15, Anne van Kesteren wrote:
On Sat, 07 Jan 2012 11:30:42 +0100, Julian Reschke
<[email protected]> wrote:
charset is undefined on application/json, so ignoring it is the right
thing.
text/event-stream;charset=hz-gb-2312 on the other hand is invalid (as
far as I understand the spec), so if this defaults to UTF-8 this is
just an effect of the specified error handling.
I guess so. FWIW, the theory that 'charset' is defined for certain media
types and not for others is not necessarily implemented that way. E.g.
XMLHttpRequest text decoding just searches for a 'charset' parameter
regardless of what the media type is. Not sure if that is the only
context in which implementations diverge from the theoretical model (the
theoretical model is kind of impossible to work with for generic code).
For text/* this is ok. For others, maybe not. It's still better than
having to special-case each and every media type...
Best regards, Julian