hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jakarta-httpclient Wiki] Update of "FrequentlyAskedApplicationDesignQuestions" by OrtwinGlueck
Date Tue, 19 Dec 2006 09:14:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-httpclient Wiki" for change
notification.

The following page has been changed by OrtwinGlueck:
http://wiki.apache.org/jakarta-httpclient/FrequentlyAskedApplicationDesignQuestions

The comment on the change is:
Rewritten the encoding / URL-escaping paragraph to not mixup the two.

------------------------------------------------------------------------------
  only way to send parameters with a GET method.
  (Unless your application encodes parameters into the URL path.)
  
- Query strings work only for string values. Each space character needs to
+ The names and values of a query string must be URL-escaped. Each space character needs to
- be replaced by a + character. Special characters like = & % + need to be
+ be replaced by a + character. Reserved characters like = & % + : / need to be
+ URL-escaped (%xx sequences) with their byte representation (see below).
- escaped as a % character followed by two hex digits specifying
- the ASCII value of the character.
- This encoding is automatically handled for example by the [http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html#URI(java.lang.String,%20java.lang.String,%20java.lang.String,%20int,%20java.lang.String,%20java.lang.String,%20java.lang.String)
java.net.URI]
+ URL-escaping is automatically handled for example by the [http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html#URI(java.lang.String,%20java.lang.String,%20java.lang.String,%20int,%20java.lang.String,%20java.lang.String,%20java.lang.String)
java.net.URI]
  and [http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/URI.html#setRawQuery(char%5b%5d)
org.apache.commons.httpclient.URI] classes.
- URLs are confined to using ASCII characters exclusively. Only ASCII values
- can reliably be transferred in a query string. However, some browsers
- handle non-ASCII input in HTML forms by encoding those characters, for
- example in UTF-8, and escaping the non-ASCII bytes as %xx sequences.
+ 
+ HTTP Request lines and thus query strings are confined to the ASCII character encoding.
Only ASCII names/values
+ can reliably be transferred in a query string. However it is possible to use a non-ASCII
character encoding by
+ URL-escaping the characters. Character encodings (like UTF-8, ISO-8859-1; and unlike EBCDIC)
whose lower 7-bit are 
+ compatible with ASCII only need to escape the non-ASCII characters. The character encoding
used to create and 
+ interprete the % escape sequences must be the same on the server and on the client. It is
common practice to
+ agree on UTF-8. But it is more a recommendation than a standard and must be verified in
individual cases. 
- It is strongly discouraged to send non-ASCII values in the query string.
+ To avoid problems it is strongly discouraged to send non-ASCII values in the query string.
+ 
+ Depending on the encoding the following characters are character encoded and URL-escaped
as follows:
+ || char || ASCII || ISO-8859-1 || UTF-8  || EBCDIC ||
+ || A    || A     || A          || A      || %E1    ||
+ || รค    || N/A   || %E4        || %C3%A4 || N/A    ||
+ || &    || %26   || %26        || %26    || %70    ||
  
  On the server, name/value pairs sent in a query string are available
  as parameters of the [http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#getParameter(java.lang.String)
ServletRequest].
  %xx escape sequences and + characters are automatically decoded by the Servlet API.
  If non-ASCII values are sent in the query string, the outcome depends
- on the implementation of the Servlet API and possibly also on
+ on the implementation of the Servlet API, the Content-Type header and possibly also on
  configuration parameters, such as the JVM default character set.
  That's why it is strongly discouraged to send non-ASCII values
  in the query string.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message