Here is a header from a post request on our site
Content-Type:application/x-www-form-urlencoded;charset=UTF-8
What causes the charset to appear here? Is it browser dependent?
We do have the following meta tags set on our pages
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
Thanks,
Rob
You have redundant code. Use one or the other meta tag, but not both.
Is the site HTML5? If so, it should only be:
And the meta tag must appear first directly after the opening head tag.
The webserver will inject the charset into the HTTP response. Most modern webservers do this by default, since if not specified, the default charset in HTTP 1.1 is ISO-8859-1 (Section 3.7.1 in the spec), which is an idiotic default in the year 2013.
The content type application/x-www-form-urlencoded is used when a browser is sending user responses on a form to a server.
In theory, the way this works is that the web page lists the encodings the server accepts (using accept-charset in the form element), the browser picks one, and it specifies that encoding when it sends the form data.
If the web page fails to specify any encoding in its form element (and most don’t), browsers are supposed to assume it’s the same as the one used to send the web page (as of HTML 4 – I think older versions of the protocol may have said to assume ISO-8859-1).
So if your browser is following the rules, you should be able to make it send a different charset in its post by either specifying a suitable accept-charset in the form element on the web page, or by changing the charset used by the web page (and having no accept-charset).
More discussion is here.