[Python-Dev] Dropping bytes "support" in json

Lino Mastrodomenico l.mastrodomenico at gmail.com
Tue Apr 14 10:54:04 CEST 2009


2009/4/13 Daniel Stutzbach <daniel at stutzbachenterprises.com>:
> print("Content-Type: application/json; charset=utf-8")

Please don't do that! According to RFC 4627 the "charset" parameter is
not allowed for the application/json media type.

Just use "Content-Type: application/json", the charset is only
misleading because even if you specify, e.g., ISO-8859-1 a
standard-compliant receiver will probably still try to interpret the
content as UTF-8/16/32.

OTOH a charset can be used if you send JSON with an
application/javascript MIME type.

-- 
Lino Mastrodomenico


More information about the Python-Dev mailing list