commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerry Tian" <>
Subject how to send post request of multibytes chracters in specified encoding with httpclient?
Date Tue, 04 Jul 2006 05:37:54 GMT
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:
For additional commands, e-mail:

View raw message