phoebe chen created HTTPCORE-734:
------------------------------------
Summary: When create UrlEncodedFormEntity, "~" is not encoded as
%7E
Key: HTTPCORE-734
URL: https://issues.apache.org/jira/browse/HTTPCORE-734
Project: HttpComponents HttpCore
Issue Type: Bug
Components: HttpCore
Affects Versions: 5.2.1
Reporter: phoebe chen
We are doing upgrade from httpclient (4.5.13) to httpclient5 (5.2.1).
And after the upgrade, we found when use following sample code to create a post
request, the request execution will fail with 400 Bad Request error, because
the character "~" in parameter string is not encoded into %7E. If we set the
charset for UrlEncodedFormEntity to UTF-8, still hit same issue.
{code:java}
HttpPost request = new HttpPost(strUrl);
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("name", "a~b"));
HttpEntity postParams = new UrlEncodedFormEntity(parameters);
request.setEntity(postParams);
{code}
While the encoding was working correctly with httpclient (4.5.13).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]