Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wherever possible, a POST method should be used when international characters are involved.

This is because :

  1. The web browser records the way it has encoded the content data in the MIME headers that precede the content itself,
  2. The web server uses this MIME header to apply the correct decoding to the character content,
  3. 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:

Content-Type: application/x-www-form-urlencoded;charset=UTF-8

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

...

Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery