title: What is the encoding of an HTTP request?
body: <p>When doing something like <code>json_encode($_SERVER)</code> I get an error because the input to be JSON-encoded is not valid UTF-8.  In fact, I looked into this error and noticed some user agent strings were encoded in ISO-8859-1.  How do I know what encoding was used for the HTTP request, so that I can use <code>utf8_encode()</code> or <code>iconv()</code> as appropriate to be able to JSON-encode the data?</p>