title: Can charset parameter be used with application/json content type in http/1.1?
body: <p><a href="https://stackoverflow.com/q/26620">For example, is it valid ajax request</a>:</p>
  <pre class="lang-javascript prettyprint-override"><code>$.ajax({
      type: &quot;POST&quot;,
      url: &quot;SomePage.aspx/GetSomeObjects&quot;,
      contentType: &quot;application/json; charset=utf-8&quot;,
      ...
  });
  </code></pre>
  <p>It is <a href="http://pyramid.readthedocs.org/en/latest/narr/webob.html#request-json-body" rel="nofollow noreferrer">used as an example sometimes</a>, or software <a href="http://bugs.cometd.org/browse/COMETD-55" rel="nofollow noreferrer">can break without explicit charset</a>.</p>
  <p><a href="https://www.rfc-editor.org/rfc/rfc4627#section-6" rel="nofollow noreferrer">The rfc 4627 for application/json media type</a> says that it doesn't accept any parameters in section 6:</p>
  <pre><code>The MIME media type for JSON text is application/json.
  
  Type name: application
  
  Subtype name: json
  
  Required parameters: n/a
  
  Optional parameters: n/a
  </code></pre>
  <p><a href="https://github.com/mitsuhiko/flask/issues/454" rel="nofollow noreferrer">It can be interpreted that charset shouldn't be used with application/json</a>.</p>
  <p>And <a href="https://www.rfc-editor.org/rfc/rfc4627#section-3" rel="nofollow noreferrer">section 3</a> suggests
  that it is not necessary to specify charset:</p>
  <pre><code>JSON text SHALL be encoded in Unicode.  The default encoding is
  UTF-8.
  
  Since the first two characters of a JSON text will always be ASCII
  characters [RFC0020], it is possible to determine whether an octet
  stream is UTF-8, UTF-16 (BE or LE), or UTF-32 (BE or LE) by looking
  at the pattern of nulls in the first four octets.
  
          00 00 00 xx  UTF-32BE
          00 xx 00 xx  UTF-16BE
          xx 00 00 00  UTF-32LE
          xx 00 xx 00  UTF-16LE
          xx xx xx xx  UTF-8
  </code></pre>
  <p>because UTF-8,16,32 encodings can be infered from the content. Why does it say that UTF-8 is default? The way to choose other character encoding is not specified in the rfc and the encoding can be found deterministically anyway. Or are there other (not UTF-8,16,32) character encodings that support Unicode?</p>
  <p>Some argue that <a href="http://code.google.com/p/guava-libraries/issues/detail?id=915" rel="nofollow noreferrer">charset can be used</a>:</p>
  <blockquote>
  <p>I disagree with your assessment that it <em>must</em> be dropped.  RFC 2046
  states that &quot;other media types than subtypes of &quot;text&quot; might choose to
  employ the charset parameter as defined here,&quot; which indicates that
  there is no restriction on the presence of the charset parameter on
  application types.  Additionally, RFC 2045 states that &quot;MIME
  implementations must ignore any parameters whose names they do not
  recognize.&quot;  So, it is not reasonable to assume that there is any harm
  being done by its presence.</p>
  </blockquote>
  <p>May rfc-compliant software generate content type application/json with a charset parameter? Should rfc-compliant software accept such requests?</p>