You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (Jira)" <ji...@apache.org> on 2023/02/18 09:54:00 UTC

[jira] [Resolved] (HTTPCORE-734) When create UrlEncodedFormEntity, "~" is not encoded as %7E

     [ https://issues.apache.org/jira/browse/HTTPCORE-734?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCORE-734.
----------------------------------------
    Resolution: Invalid

> 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
>            Priority: Minor
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org