You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jerry Tian <je...@gmail.com> on 2006/07/04 07:37:54 UTC

how to send post request of multibytes chracters in specified encoding with httpclient?

so far as I know, the default encoding of  "UTF-8" is used(using a
sniffer to capture the request), below is my code:

HttpClient httpClient = getNewHttpClient();

PostMethod postMethod = new PostMethod(formBaseUrl);

postMethod.addRequestHeader("Referer", refererBaseUrl);
postMethod.addRequestHeader("User-Agent", "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.2; Maxthon; .NET CLR 1.1.4322)");

NameValuePair uin = new NameValuePair("UIN", id);
NameValuePair verify = new NameValuePair("VERIFY", key);
postMethod.setRequestBody(new NameValuePair[] {uin, verify});

The "VERIFY" may contain multibytes characters(Chinese), and the
server only accepts it in specified encoding(GB2312). I have googled a
lot and read the mannual and tried hard, but still failed to make it
work with other encodings. Any solution to this?

Thanks in advance! Good day :-)

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