You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2003/04/07 13:50:59 UTC

DO NOT REPLY [Bug 18752] - the method to change the field values of HttpConstants

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18752>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18752

the method to change the field values of HttpConstants

adrian@ephox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



------- Additional Comments From adrian@ephox.com  2003-04-07 11:50 -------
The values of these fields are set according the HTTP specification and so
should not be changed.  Despite this, HttpClient can very simply be used with
alternative character sets and there are a number of options for doing this.

The best and most compliant method is to set the server to correctly report the
character encoding and HttpClient will honour that.  For instance if the HTTP
server returns a header:

Content-Type: text/html; charset=SJIS

HttpClient will use the SJIS character encoding when you call
getResponseBodyAsString.

Alternatively, you can simply retrieve the response body as either an input
stream or a byte array then use whatever file encoding you prefer.

The HTTP_ELEMENT_CHARSET is always and must always be US-ASCII as that is the
character encoding used for Http headers.  It is therefore not possible to use
double byte characters in the Http headers as this is not supported by the HTTP
protocol.  This however, has no effect on the contents of the request or
response body which may use any character encoding or be binary data.

There is more information on character encodings and HttpClient at:
http://jakarta.apache.org/commons/httpclient/charencodings.html

Generally though it is the responsibility of the application to select and apply
the appropriate character set as HttpClient normally does not process the
response body at all.

If you need further assistance, I'd be happy to help, please subscribe to the
HttpClient Developer list and ask any questions you have there.  Details of the
list are at: http://jakarta.apache.org/commons/httpclient/mail-lists.html