You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Henrik Alstad (JIRA)" <ji...@apache.org> on 2014/07/31 20:33:40 UTC
[jira] [Created] (HTTPCLIENT-1533) MultipartEntity encoding
regression bug
Henrik Alstad created HTTPCLIENT-1533:
-----------------------------------------
Summary: MultipartEntity encoding regression bug
Key: HTTPCLIENT-1533
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1533
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient, HttpMime
Affects Versions: 4.3.4
Environment: Linux
Reporter: Henrik Alstad
Not 100% sure if it's a bug, but in any case, the small code snippet below works with version 4.3.1, but not the most recent 4.3.4
(And when I say 4.3.4 doesen't work, I mean that it does compile, it does run, it does fire off the request, but the server responds that there's something wrong with the UTF-8 encoding... it seems like the receiving server treats the content as ISO8859-1.)
Is this a bug? Something must have changed at least, between 4.3.1 and 4.3.4. I only changed versions and didnt touch the code.
StringBody tblId = new StringBody(properties.getProperty("tbl-script-name"), ContentType.TEXT_PLAIN.withCharset("UTF-8"));
ByteArrayBody data = new ByteArrayBody(message.getBytes("UTF-8"), ContentType.TEXT_XML.withCharset("UTF-8"), "file");
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart(properties.getProperty("tbl-id-parameter"), tblId)
.addPart(properties.getProperty("tbl-file-parameter"), data)
.setCharset(Charset.forName("UTF-8"))
.build();
post.setEntity(reqEntity);
CloseableHttpResponse response = HttpClients.createDefault().execute(post);
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org