Hello,
I am using httpclient ( commons-httpclient-3.1 ) in my project and
very happy with it. But since last two weeks I stuck up with an issue as
describe bellow.
On one my website which is compatible with UTF-8, I am uploading a
file with Postmethod and its work really very fine, but there are some
other text field other then file on that page for which I have to pass
values. When I am execute the method with other utf-8 character values
of those text field get corrupted. So please help me regarding this
issue. I need it really very fast.
The code I am using is as bellow.
postObj = new PostMethod(url);
postObj.setRequestHeader(referer);
postObj.setRequestHeader(CharacterEncoding);
ArrayList<Part> parts = new
ArrayList<Part>();
FilePart fpart = new
FilePart(fileAttribute.getAttributeName(), file);
parts.add(new
FilePart(fileAttribute.getAttributeName(), file));
for(String param:paraNames){
JSONArray array =
jsonObj.optJSONArray(param);
// param value that get corrupted
StringPart spart = new
StringPart(param, jsonObj.getString(param),"UTF-8");
spart.setContentType("text/plain;
charset=utf-8");
spart.setCharSet("UTF-8");
parts.add(spart);
}
postObj.setRequestEntity(new
MultipartRequestEntity(parts.toArray(new Part[0]), postObj.getParams()));
int rtnStatus = 0;
try{
rtnStatus =
httpClient.executeMethod(postObj);
}
Thanks for read my problem.
regards,
Jaydeep Fifadra
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]