hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Alstad (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1533) MultipartEntity encoding regression bug
Date Thu, 31 Jul 2014 18:33:40 GMT
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"),

HttpEntity reqEntity = MultipartEntityBuilder.create()
.addPart(properties.getProperty("tbl-id-parameter"), tblId)
.addPart(properties.getProperty("tbl-file-parameter"), data)


CloseableHttpResponse response = HttpClients.createDefault().execute(post);

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message