On 18/09/2003 5:02 PM, "Eric Chow" <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> When I tried to use HttpClient to query a web site with a "UTF-8" paramter,
> it just can't match.
> 
> When I tried to "Copy & Paste" the character into that web site, it works,
> but failed to use HttpClient.
> 
> Is there any problem in HttpClient to handle UTF-8 parameters ???
> 
> 
> Web Side: http://www.mandarintools.com/chardict_u8.html
> In "Paste in Character", select "UTF-8", and paste 与, (the UTF-8 of the
> previous character is \u4E0E),
> and then "Search by Character".
> 
> It should return something ....
> 
> 
> The following is my source, please teach me how can I pass UTF-8 query
> parameters in HttpClient.


Hi Eric,
I don't think I quite understand what problem you're having.  If the problem
is actually with UTF-8 encoding then the bug lies in the unicodeToString
method since that's where the unicode character is converted into characters
that can be represented in ASCII.  Note that by default the post request
body are sent using ISO-8859-1 encoding not UTF-8, you can change that by
setting the Content-Type header on the post method you've created.  Since
the characters you are sending can all be safely represented in the
ISO-8859-1 charset I don't think this is your problem though.

The other problem you might be having is that the response from the server
is missing or otherwise incorrect - this is probably a general error with
HTTP communication to the server rather than an encoding problem.  To track
it down we'll need to get a wire log that shows the problem - instructions
are at http://jakarta.apache.org/commons/httpclient/logging.html

Once I can understand exactly what the problem is I'm sure it will be simple
to solve.

Regards,

Adrian Sutton.
----------------------------------------------
Intencha "tomorrow's technology today"
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD
www.intencha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to