Unable to send POST data back to GB2312. I think UTF-8 is a W3C recommendation, and all new browsers send data only in Latin-1 or UTF-8.
We were able to get the data encoded in GB2312 in the old IE on Win 95, but this is generally not possible in new Unicode-based browsers.
See this test in Firefox,
POST / HTTP/1.1 Host: localhost:1234 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 46
My page is in GB2312, and I pointed to GB2312 everywhere, but Firefox just ignores it.
Some broken browsers even encode Chinese in Latin-1. We recently added a hidden field with a known value. By checking the value, we can determine the encoding.
request.getCharacterEncoding () returns the encoding from the Content-Type. As you can see from my trace, it is always null.
source share