You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Sergey Smith (JIRA)" <ji...@apache.org> on 2015/07/20 12:38:04 UTC
[jira] [Updated] (HTTPCLIENT-1667) RequestBuilder ignores Encoding
[ https://issues.apache.org/jira/browse/HTTPCLIENT-1667?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Smith updated HTTPCLIENT-1667:
-------------------------------------
Description:
Sorry for my English.
Class *org.apache.http.client.methods.RequestBuilder* in method *build()* FORCE to use ISO-8859-1 encoding
For example my using:
{code}
HttpUriRequest post = RequestBuilder.post().setUri(url)
.setCharset(Charset.forName("Windows-1251"))
.addParameter("xml", xml).build();
{code}
QuickFix (line ~481):
{code}
if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
|| HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
-- entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
++ entityCopy = new UrlEncodedFormEntity(parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET);
{code}
I think it also may to be changed in other places in class.
was:
Sorry for my English.
Class org.apache.http.client.methods.RequestBuilder in method build() FORCE to use ISO-8859-1 encoding
For example my using:
HttpUriRequest post = RequestBuilder.post().setUri(url)
.setCharset(Charset.forName("Windows-1251"))
.addParameter("xml", xml).build();
QuickFix (line ~481):
if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
|| HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
-- entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
++ entityCopy = new UrlEncodedFormEntity(parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET);
I think it also may to be changed in other places in class.
> RequestBuilder ignores Encoding
> --------------------------------
>
> Key: HTTPCLIENT-1667
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1667
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.5
> Reporter: Sergey Smith
> Priority: Critical
>
> Sorry for my English.
> Class *org.apache.http.client.methods.RequestBuilder* in method *build()* FORCE to use ISO-8859-1 encoding
> For example my using:
> {code}
> HttpUriRequest post = RequestBuilder.post().setUri(url)
> .setCharset(Charset.forName("Windows-1251"))
> .addParameter("xml", xml).build();
> {code}
> QuickFix (line ~481):
> {code}
> if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
> || HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
> -- entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
> ++ entityCopy = new UrlEncodedFormEntity(parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET);
> {code}
> I think it also may to be changed in other places in class.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org