Content type HTTP header can contains character encodinf info
for ex. Content-Type: text/xml; charset=UTF-8
If the servlet is following spec 2.3 and higher the servlet API can be used to retrieve character encoding part of
Content-Type header. Some containers can choose to not unpack charset info - the spec is not strong about it.
in any case this method can be used as a latest resource to retrieve the passed charset value.
null is returned.
It is very common mistake to send : Content-Type: text/xml; charset="UTF-8".
Some containers are not filtering this mistake and the processing results in exception..
The getCharacterEncoding() compensates for above mistake.
Parameters:
contentType - value associated with Content-Type HTTP header.
extractCharset
protected StringextractCharset(String contentType,
int idx)