Wherever possible, a POST method should be used when international characters are involved.
This is because :
- The web browser records the way it has encoded the content data in the MIME headers that precede the content itself,
- The web server uses this MIME header to apply the correct decoding to the character content,
- There are no (practical) limits to the amount of data which can sent in this way (URL lengths may be limited by the buffers in some web/proxy servers)
The HTTP Content-Type header is used to tell the web server's Servlet classes which encoding was used. By the time the characters are made available to the Servlet as a String it is in the Unicode encoding used by Javathe browser sends a HTTP
Content-Type header which can help the web server determine the encoding of the content. The
Content-Type header will tell the server the MIME-type encoding of the content (usually
application/x-www-form-urlencoded) and also can optionally include the character encoding of the content eg:
If both the MIME-type and the charset encoding information is sent in the POST HTTP header, the server can correctly decode the content.
Unfortunately, many browsers do not bother to send the charset information, leaving the web server to guess the correct encoding. For this reason, the Servlet API provides the
SevletRequest.setCharacterEncoding(String) method to allow the webapp developer to control the decoding of the form content.
Jetty-6 uses a default of UTF-8 if no overriding character encoding is set on a request.
International characters in URLs